/** * 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()); }
/** * load option grid posts * @param WP_Widget $t: widget object * @param array $instance: widget data */ function do_widget_feature($t, $instance = array()) { $this->widget_instance = $instance; //maybe update widget instance $enable_fancybox = $this->get_field_value('awc_enable_fancybox'); echo '<div class="awc-widget-feature-fancybox"><fieldset><legend>Fancybox</legend>'; if (class_exists('HW_NHP_Main_Settings', false)) { echo '<p><a href="' . HW_NHP_Main_Settings::get_setting_page_url() . '" target="_blank">Kích hoạt & cấu hình fancybox</a></p>'; } echo '<div ><input type="checkbox" name="' . $this->get_field_name('awc_enable_fancybox') . '" id="' . $this->get_field_id('awc_enable_fancybox') . '" ' . esc_attr($enable_fancybox ? 'checked="checked"' : '') . '/>'; echo '<label for="' . $this->get_field_id('awc_enable_fancybox') . '"><strong>Kích hoạt fancybox</strong></label></div>'; //grids column #echo '<div><label for="'.$t->get_field_id('awc_grid_fancybox').'"><strong>Số cột posts grid:</strong></label>'; #echo '<input size="5" type="text" name="'.$t->get_field_name('awc_grid_fancybox').'" id="'.$t->get_field_id('awc_grid_fancybox').'" value="'.$instance['awc_grid_fancybox'].'"/></div>'; echo '<div> <span>Cài đặt options</span><br/> <label><input type="radio" name="' . $this->get_field_name('use_default_opts') . '" class="' . $this->get_field_id('use_default_opts') . '" id="' . $this->get_field_id('use_default_opts') . '" value="default" ' . ($this->get_field_value('use_default_opts') == 'default' ? "checked='checked'" : "") . '/> Mặc định</label> <label><input type="radio" name="' . $this->get_field_name('use_default_opts') . '" class="' . $this->get_field_id('use_default_opts') . '" id="' . $this->get_field_id('use_default_opts') . '" value="extend" ' . ($this->get_field_value('use_default_opts') == 'extend' ? "checked='checked'" : "") . '/> Mới</label> </div>'; if (file_exists(plugin_dir_path(__FILE__) . '/options.php')) { include plugin_dir_path(__FILE__) . '/options.php'; } if (isset($theme_options)) { $class = $this->get_field_value('use_default_opts') == 'default' ? 'hw-hidden' : ''; echo '<div id="' . $this->get_field_id('fancybox-settings') . '" class="' . $class . '">'; echo $this->build_options($theme_options); echo '</div>'; } echo '<script> jQuery(function($) { $(".' . $this->get_field_id('use_default_opts') . '").click(function(e) { var setting_container = "#' . $this->get_field_id('fancybox-settings') . '"; if($(this).val() == "default") { $(setting_container).hide(); } else $(setting_container).show().removeClass("hw-hidden"); }); }); </script> '; echo '</fieldset></div>'; }
/** * load options fixed widget feature * @param WP_Widget $t: widget object * @param array $instance: widget data */ function do_widget_feature($t, $instance = array()) { $this->widget_instance = $instance; //maybe update widget instance $enable_fixed = $this->get_field_value('awc_enable_fixed_widget'); $lib = $this->get_field_value('awc_fixedobj_lib'); echo '<div class="awc-widget-feature-fixed_widget"><fieldset><legend>Fixed widget</legend>'; if (class_exists('HW_NHP_Main_Settings', false)) { echo '<p><a href="' . HW_NHP_Main_Settings::get_setting_page_url() . '" target="_blank">Kích hoạt & cấu hình fixed widget</a></p>'; } echo '<div ><input type="checkbox" name="' . $this->get_field_name('awc_enable_fixed_widget') . '" id="' . $this->get_field_id('awc_enable_fixed_widget') . '" ' . esc_attr($enable_fixed ? 'checked="checked"' : '') . '/>'; echo '<label for="' . $this->get_field_id('awc_enable_fixed_widget') . '"><strong>Kích hoạt fixed widget</strong></label></div>'; //grids column echo '<label for="' . $this->get_field_id('awc_fixedobj_lib') . '"><strong>Chọn thư viện</strong></label>'; $fixed_libs = array('sticky' => 'Sticky', 'sticky-kit' => 'Sticky Kit'); echo HW_UI_Component::build_select_tag($fixed_libs, $lib, array('name' => $this->get_field_name('awc_fixedobj_lib'), 'id' => $this->get_field_id('awc_fixedobj_lib'))); #echo '<div><label for="'.$t->get_field_id('awc_grid_fancybox').'"><strong>Số cột posts grid:</strong></label>'; #echo '<input size="5" type="text" name="'.$t->get_field_name('awc_grid_fancybox').'" id="'.$t->get_field_id('awc_grid_fancybox').'" value="'.$instance['awc_grid_fancybox'].'"/></div>'; /*echo '<div> <span>Cài đặt options</span><br/> </div>';*/ if ($lib == 'sticky-kit') { if (file_exists(plugin_dir_path(__FILE__) . '/options-sticky-kit.php')) { include plugin_dir_path(__FILE__) . '/options-sticky-kit.php'; } } elseif (file_exists(plugin_dir_path(__FILE__) . '/options.php')) { include plugin_dir_path(__FILE__) . '/options.php'; } //build theme options if (isset($theme_options)) { echo '<div id="' . $this->get_field_id('fixed_widget-settings') . '" class="">'; echo $this->build_options($theme_options); echo '</div>'; } echo '<script> jQuery(function($) { }); </script> '; echo '</fieldset></div>'; }