/** * Sets up the form. * * Alternatively you may use load_{instantiated class name} method. */ public function load($oAdminWidget) { //get all hwml shortcodes $hwml_data = HWMLShortcode_Manager::get_hwml_slideshow_posts(); HW_UI_Component::empty_select_option($hwml_data); //register form fields $this->addSettingFields(array('field_id' => 'title', 'type' => 'text', 'title' => __('Tiêu đề', 'hwml'), 'default' => ''), array('field_id' => 'slider', 'type' => 'select', 'label' => $hwml_data, 'title' => __('Chọn slider', 'hwml'), 'description' => ''), array('field_id' => 'use_default_slider', 'type' => 'checkbox', 'title' => 'Lấy slider mặc định', 'description' => 'Sử dụng slider đã thiết lập mặc định <a href="' . HW_NHP_Main_Settings::get_setting_page_url() . '" target="_blank">tại đây</a>.'), array()); }
/** * Sets up the form. * * Alternatively you may use load_{instantiated class name} method. */ public function load($oAdminWidget) { //get all hwml shortcodes $data = hw_gallery_get_galleries(); $galleries = array(); foreach ($data as $gallery) { $galleries[$gallery['id']] = $gallery['title']; } HW_UI_Component::empty_select_option($galleries); //register form fields $this->addSettingFields(array('field_id' => 'title', 'type' => 'text', 'title' => __('Tiêu đề', 'hw-gallery'), 'default' => ''), array('field_id' => 'gallery', 'type' => 'select', 'label' => $galleries, 'title' => __('Chọn Gallery', 'hw-gallery'), 'description' => ''), array()); }
/** * main class constructor */ public function __construct() { //list taxonomies $tax_data = HW_POST::hw_list_taxonomies(array('hw-ml-slider')); //array_unshift($tax_data, '--Select--'); HW_UI_Component::empty_select_option($tax_data); $this->tax_data = $tax_data; //list templates for current theme $this->theme_templates_list = array('-1' => 'Mặc định'); $templates = hw_list_active_theme_templates(); foreach ($templates as $file) { $this->theme_templates_list[base64_encode($file['path'])] = $file['name']; } //add action filters $this->add_actions(); }
/** * Triggered when the tab is loaded. * @param $oAdminPage */ public function replyToAddFormElements($oAdminPage) { $modules_pos = HW_Modules_Manager::get_modules_displayable(); //list displayable modules $avaiable_pages = HW__Template::get_pages_select(); //pages //get all register positions $positions = HW_Module_Positions::get_positions(); HW_UI_Component::empty_select_option($positions); //condition $conditions = array(); $dynamic_settings = HW_Condition::get_active_conditions_settings(); foreach ($dynamic_settings as $id => $item) { $conditions[$id] = $item['title']; } HW_UI_Component::empty_select_option($conditions); $this->addFieldLabel('Cấu hình vị trí của các modules'); $this->addFields(array('field_id' => 'modules_position', 'type' => 'hw_table_fields', 'title' => '', 'show_title_column' => false, 'repeatable' => false, 'show_root_field' => true, 'data_base_field' => 'col1', 'attributes' => array('hw_table_fields' => array()), 'fields' => array('col1' => array('name' => 'module', 'type' => 'select', 'options' => $modules_pos, 'description' => ''), 'col2' => array('name' => 'condition', 'type' => 'select', 'options' => $conditions, 'description' => ''), 'col3' => array('name' => 'page', 'type' => 'select', 'options' => $avaiable_pages, 'description' => ''), 'col4' => array('name' => 'position', 'type' => 'select', 'options' => $positions)), 'table_header' => array('col1' => 'Module', 'col2' => 'Điều kiện', 'col3' => 'Trang hiển thị', 'col4' => 'Vị trí'))); }
/** * fields setting for positions tab */ private function setting_form_positions_tab() { global $wp_registered_sidebars; $position_tab = $this->add_tab(array('id' => 'sidebars_pos', 'title' => 'Vị trí hiển thị', 'description' => 'Quản lý Vị trí hiển thị')); //get all register positions $positions = HW_Module_Positions::get_positions(); HW_UI_Component::empty_select_option($positions); $position_tab->addFieldLabel('Cấu hình vị trí của sidebars'); //list all avaiable sidebars $sidebars_list = array(); foreach ($wp_registered_sidebars as $sidebar) { $sidebar = self::_valid_sidebar($sidebar); //valid if (!isset($sidebar['id'])) { continue; } $sidebars_list[$sidebar['id']] = !empty($sidebar['name']) ? $sidebar['name'] : $sidebar['description']; } $position_tab->addFields(array('field_id' => 'sidebars_position', 'type' => 'hw_table_fields', 'title' => '', 'show_title_column' => false, 'repeatable' => false, 'show_root_field' => true, 'data_base_field' => 'col1', 'attributes' => array('hw_table_fields' => array()), 'fields' => array('col1' => array('name' => 'sidebar', 'type' => 'select', 'options' => $sidebars_list, 'description' => ''), 'col2' => array('name' => 'position', 'type' => 'select', 'options' => $positions)), 'table_header' => array('col1' => 'Sidebar', 'col2' => 'Vị trí'))); }
/** * get all pages * @param bool $empty_item * @return array */ public static function get_pages_select($empty_item = true) { $pages = get_pages(); $options = array(); foreach ($pages as $page) { $options[$page->ID] = $page->post_title; } if ($empty_item) { HW_UI_Component::empty_select_option($options); } return $options; }