/** * Constructor. * * @param array $config Field declaration. * @param array $merge Array of property should be merged. * * @return void */ public function __construct($config, $merge = array('attributes', 'choices')) { // Get all themes for mega menu $path = apply_filters('wr_megamenu_themes', WR_MEGAMENU_ROOT_PATH . 'themes'); $files = WR_Megamenu_Helpers_Functions::get_theme_styles($path); $this->choices = $files; // Call parent method to do remaining initialization parent::__construct($config, $merge); }
<div class="top-buttons-right pull-right"> <button id="btn-submenu-styling" class="btn btn-default"><?php _e('Styling', WR_MEGAMENU_TEXTDOMAIN); ?> </button> <button id="page-custom-css" class="btn btn-default"><?php _e('Custom CSS', WR_MEGAMENU_TEXTDOMAIN); ?> </button> <div id="menu-styling" class="styling-modal jsn-bootstrap3" style="display: none;"> <?php $themes_style = array(); // Get all themes for mega menu $path = apply_filters('wr_megamenu_themes', WR_MEGAMENU_ROOT_PATH . 'themes'); $files = WR_Megamenu_Helpers_Functions::get_theme_styles($path); if (count($files)) { foreach ($files as $theme => $value) { $themes_style[$theme] = ucfirst($theme); } } $theme_default_options = array('menu-bar-font' => 'inherit', 'menu-bar-bg_value' => '#000', 'menu-bar-bg' => '#000', 'menu-bar-font_type' => 'Standard Font', 'menu-bar-font_face' => 'Arial', 'menu-bar-font_size' => '10', 'menu-bar-font_weight' => 'bold', 'menu-bar-menu_color' => '#fff', 'menu-bar-menu_layout' => 'horizontal', 'menu-bar-on_hover' => '#1cba70', 'menu-bar-stick_menu' => 'no', 'menu-bar-icon_display_mode' => 'text_only', 'menu-bar-icon_position' => 'left', 'menu-bar-icon_size' => '16', 'heading-text-font' => 'inherit', 'heading-text-font_type' => 'Standard Font', 'heading-text-font_face' => 'Arial', 'heading-text-font_size' => '10', 'heading-text-font_weight' => 'bold', 'heading-text-menu_color' => '#000', 'normal-text-font' => 'inherit', 'normal-text-font_type' => 'Standard Font', 'normal-text-font_face' => 'Arial', 'normal-text-font_size' => '10', 'normal-text-font_weight' => 'bold', 'normal-text-menu_color' => '#000', 'submenu-panel-bullet_icon' => 'yes'); // get options from many themes $selected_theme = isset($data['theme_style']) ? $data['theme_style'] : 'default'; $themes_options = get_post_meta($profile->ID, WR_MEGAMENU_META_KEY . '_themes_options', true); $themes_options = json_decode($themes_options, true); foreach ($themes_style as $key => $theme) { $setting = isset($themes_options[$key]) ? json_decode($themes_options[$key], true) : array(); $theme_options = wp_parse_args($setting, $theme_default_options); $options = json_encode($theme_options); echo balanceTags("<input type='hidden' class='style-{$key}' id='style-{$key}' value='{$options}' name='theme_options[]'/>");