/** * setup form fields */ public function setUp() { // Set the root menu $this->setRootMenuPage('Settings'); // specifies to which parent menu to add. // Add the sub menus and the pages $this->addSubMenuItems(array('title' => 'Lưu cấu hình widgets', 'page_slug' => self::PAGE_SLUG)); //define tabs $this->addInPageTabs(self::PAGE_SLUG, array('tab_slug' => 'widgets-config', 'title' => __('Cấu hình widgets'))); $this->setInPageTabTag('h2'); // sets the tag used for in-page tabs //init fields $this->addSettingFields(array('field_id' => 'list_saved_widgets_setting', 'type' => 'hw_admin_table', 'title' => '', 'show_title_column' => false, 'WP_List_Table' => 'HW_List_Table_Widgets_settings', 'columns' => array('id' => __('ID'), 'name' => __('Tên'), 'group' => __('Nhóm'), 'widget' => __('Widget'), 'description' => __('Mô tả'), 'setting' => __('Config')), 'sortable_columns' => array('id' => array('id', false), 'name' => array('name', false), 'group' => array('group', false)))); /*$this->addSettingFields( array( 'field_id' => 'test', 'type' => 'text', 'title' => 'Title 1', ) );*/ //actions if (class_exists('HW_HELP')) { $page_hook = HW_HELP::load_settings_page_hook_slug(self::PAGE_SLUG); } else { $page_hook = 'load-settings_page_' . self::PAGE_SLUG; } add_action($page_hook, array($this, '_add_options')); if (class_exists('HW_HOANGWEB') && HW_HOANGWEB::is_current_screen('hw_widgets_settings')) { add_action('admin_enqueue_scripts', array($this, '_admin_enqueue_scripts')); } }
/** * @hook plugins_loaded */ private function add_screen_options() { HW_HOANGWEB::load_class('HW_Screen_Option'); if (class_exists('HW_HELP', false)) { $page_slug = HW_HELP::load_settings_page_hook_slug(self::PAGE_SLUG, ''); $screen = HW_Screen_Option::get_instance('hw_module_setting_page', $page_slug); #HW_Screen_Option::get('modules-manager')->get_option('xx'); $screen->add_options(array('per_page' => array('label' => 'Số lượng/trang', 'default' => '10'))); $screen->addition_text('Dành cho trang cấu hình Module Hoangweb.'); } }
/** * Triggered when the tab is loaded. * @param $oAdminPage */ public function replyToAddFormElements($oAdminPage = '') { //you can get feature data belong to current widget that applying $this->addFields(array('field_id' => 'list_saved_widgets_setting', 'type' => 'hw_admin_table', 'title' => '', 'show_title_column' => false, 'WP_List_Table' => 'HW_List_Table_Widgets_settings', 'columns' => array('id' => __('ID'), 'name' => __('Tên'), 'group' => __('Nhóm'), 'widget' => __('Widget'), 'description' => __('Mô tả'), 'setting' => __('Config')), 'sortable_columns' => array('id' => array('id', false), 'name' => array('name', false), 'group' => array('group', false)))); //actions if (class_exists('HW_HELP')) { $page_hook = HW_HELP::load_settings_page_hook_slug(HW_Widget_Features_Setting::PAGE_SLUG); } else { $page_hook = 'load-settings_page_' . HW_Widget_Features_Setting::PAGE_SLUG; } add_action($page_hook, array($this, '_add_options')); if (class_exists('HW_HOANGWEB') && HW_HOANGWEB::is_current_screen('hw_widgets_settings')) { add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); } }
/** * @hook plugins_loaded */ private function add_screen_options() { HW_HOANGWEB::load_class('HW_Screen_Option'); if (class_exists('HW_HELP', false)) { $hook_slug = HW_HELP::load_settings_page_hook_slug($this->menu, ''); } else { $hook_slug = ''; } $screen = HW_Screen_Option::get_instance('modules_manager', $hook_slug); #HW_Screen_Option::get('modules-manager')->get_option('xx'); $screen->add_options(array('per_page' => array('label' => 'Số lượng/trang', 'default' => '10'))); $screen->addition_text('Hiển thị danh sách Modules Hoangweb.'); }