/**
  * Generate the configuration for help tab.
  *
  * The configuration needs to contain three keys:
  * - title: Title of the tab.
  * - template: Name of the Twig template (assuming the 'help' namespace is available)
  * - context: Context object for Twig.
  *
  * @param string $page_name Name of current page.
  * @return array|null Help tab configuration array or null when no help tab should be displayed.
  * @since 2.0
  */
 private function get_help_config($page_name)
 {
     switch ($page_name) {
         case Types_Admin_Menu::PAGE_NAME_FIELD_CONTROL:
             return Types_Page_Field_Control::get_instance()->get_help_config();
         default:
             return null;
     }
 }
 /**
  * Check if an on-demand submenu should be added, and jumpstart it's controller if needed.
  *
  * On-demand submenu means that the submenu isn't displayed normally, it appears only when its page is loaded.
  *
  * Note: All page controllers should inherit from Types_Page_Abstract.
  *
  * @param array $pages Array of menu item definitions.
  * @param string $page_name
  * @return array Updated item definition array.
  * @since 2.0
  */
 private function maybe_add_ondemand_submenu($pages, $page_name)
 {
     $page = null;
     switch ($page_name) {
         case self::PAGE_NAME_FIELD_CONTROL:
             $page = Types_Page_Field_Control::get_instance();
             break;
         case self::PAGE_NAME_HELPER:
             Types_Page_Hidden_Helper::get_instance();
             break;
     }
     if ($page instanceof Types_Page_Abstract) {
         // Jumpstart the page controller.
         try {
             $page->prepare();
         } catch (Exception $e) {
             wp_die($e->getMessage());
         }
         $pages[$page_name] = array('slug' => $page_name, 'menu_title' => $page->get_title(), 'page_title' => $page->get_title(), 'callback' => $page->get_render_callback(), 'load_hook' => $page->get_load_callback(), 'capability' => $page->get_required_capability(), 'contextual_help_hook' => array(Types_Asset_Help_Tab_Loader::get_instance(), 'add_help_tab'));
         // todo we might need to handle adding URL parameters to submenu URLs in some standard way, it's common scenario for ondemand submenus
     }
     return $pages;
 }