/** * Used this method to add tab and sidebar to the screen * * @brief Display */ public function display() { // Merging $this->tabs = array_merge($this->tabs, (array) $this->tabs()); // Add the tabs foreach ($this->tabs as $title => $callable_content) { $this->addTab($title, $callable_content); } // Add the sidebar if exists $sidebar = $this->sidebar(); if (!empty($sidebar)) { $current = $this->currentScreen->get_help_sidebar(); $this->currentScreen->set_help_sidebar($current . $sidebar); } }
/** * Applies the new sidebar contents based on loaded files. * * This should be called during WordPress's `admin_head` hook. * * @link https://developer.wordpress.org/reference/hooks/admin_head/ * * @uses Parsedown::text() * @uses WP_Screen::get_help_sidebar() * @uses WP_Screen::set_help_sidebar() * * @return @void */ public function applySidebar() { foreach ($this->_sidebar_files as $file) { if (is_readable($file)) { $this->_screen->set_help_sidebar($this->_screen->get_help_sidebar() . $this->get_parsedown()->text(file_get_contents($file))); } } }