private static function build_input_glyphicon_select($option_settings_db_name, $settings_value, My_Plugin_Settings_Node $settings_node) { $id = $settings_node->id; $title = $settings_node->title; $description = $settings_node->description; $select_options = $settings_node->select_options; $class = $settings_node->class; $display_class = isset($settings_value) && $settings_value != '' ? '' : 'my_plugin_hidden'; $glyphicon_preview_value = isset($settings_value) && $settings_value != '' ? $settings_value : ''; $glyphicon_selector = My_Plugin_Icons::get_glyphicons_list(); return "<div class='my_plugin_input'>\n\n <!-- the text box input, hidden as media is selected from popup -->\n <input id='{$id}'\n name='{$option_settings_db_name}[{$id}]'\n class='my_plugin_glyphicon-select_value my_plugin_hidden {$class}'\n type='text'\n value='{$settings_value}'/>\n\n <!-- the button to open the popup browser and choose/upload a Dashicon (jQuery) -->\n <input id='{$id}_button'\n class='my_plugin_glyphicon-select_button button'\n type='text'\n value='Select Bootstrap Glyphicon'\n size='25'/>\n\n <!-- the garbage icon - click to clear the dashicon value and image (jQuery) -->\n <div class='my_plugin_glyphicon-select_clear my_plugin_clear_button dashicons dashicons-trash'\n id='{$id}_clear' />\n </div>\n\n <!-- the label text -->\n <label class='my_plugin_label' id='{$id}_label'>{$description}</label>\n\n <!-- a preview of the image, can be resized, hidden on load - unless there is a url available. also displayed/hidden in jQuery on load/delete -->\n <div id='{$id}_preview'\n class='my_plugin_glyphicon-select_preview {$display_class} {$glyphicon_preview_value}'\n title='{$glyphicon_preview_value}'/>\n </div>\n "; }
/** * Add the Dashicon or Glyphicon selectors if required by the plugin * @return string */ private function get_icon_selectors() { $html = ''; $require_glyphicon = $this->settings->requires_input_type(My_Plugin_Settings_Input_Type::Glyphicon_Select); $require_dashicon = $this->settings->requires_input_type(My_Plugin_Settings_Input_Type::Dashicon_Select); if ($require_glyphicon || $require_dashicon) { $html .= "<div id='my_plugin_icon_selectors'>"; if ($require_glyphicon) { $html .= My_Plugin_Icons::get_glyphicons_list(); } if ($require_dashicon) { $html .= My_Plugin_Icons::get_dashicon_list(); } $html .= "</div>"; } return $html; }