/** * * Function used to generate output of the field * * @return HTML output of the field * **/ public function output() { // load and parse XML file. $json_data = $this->tpl->get_json('config', 'menus'); // $output = ''; // prepare parser object $parser = new GavernWPFormParser($this->tpl); // iterate through all menus in the file foreach ($json_data as $menu) { $temp_json = '[ { "groupname": "' . $menu->name . '", "groupdesc": "' . $menu->description . '", "fields": [ { "name": "navigation_menu_state_' . $menu->location . '", "type": "Select", "label": "' . __('Enable', GKTPLNAME) . ' ' . $menu->name . '", "tooltip": "' . __('You can enable or disable showing the menu in the template.', GKTPLNAME) . '", "default": "Y", "other": { "options": { "Y": "' . __('Enabled', GKTPLNAME) . '", "N": "' . __('Disabled', GKTPLNAME) . '", "rule": "' . __('Conditional rule', GKTPLNAME) . '" } } }, { "name": "navigation_menu_staterule_' . $menu->location . '", "type": "Text", "label": "' . __('Conditional rule', GKTPLNAME) . '", "tooltip": "' . __('You can enable showing the menu in the specific pages.', GKTPLNAME) . '", "default": "", "class": "", "visibility": "navigation_menu_state_' . $menu->location . '=rule" }, { "name": "navigation_menu_depth_' . $menu->location . '", "type": "Select", "label": "' . __('Depth of ', GKTPLNAME) . ' ' . $menu->name . '", "tooltip": "' . __('You can specify the menu depth.', GKTPLNAME) . '", "default": "0", "other": { "options": { "0": "' . __('All levels', GKTPLNAME) . '", "1": "1", "2": "2", "3": "3", "4": "4", "5": "5" } } } ' . ($menu->main == 'true' ? ', { "name": "navigation_menu_animation_' . $menu->location . '", "type": "Select", "label": "' . __('Animation for ', GKTPLNAME) . ' ' . $menu->name . '", "tooltip": "' . __('You can specify the menu animation.', GKTPLNAME) . '", "default": "width_height_opacity", "other": { "options": { "width_height_opacity": "' . __('Width, Height and Opacity', GKTPLNAME) . '", "width_opacity": "' . __('Width and Opacity', GKTPLNAME) . '", "height_opacity": "' . __('Height and Opacity', GKTPLNAME) . '", "opacity": "' . __('Opacity', GKTPLNAME) . '", "none": "' . __('No animation', GKTPLNAME) . '" } } }, { "name": "navigation_menu_animationspeed_' . $menu->location . '", "type": "Select", "label": "' . __('Animation speed for ', GKTPLNAME) . ' ' . $menu->name . '", "tooltip": "' . __('You can specify the speed of the menu animation.', GKTPLNAME) . '", "default": "normal", "other": { "options": { "fast": "' . __('Fast animation (250ms)', GKTPLNAME) . '", "normal": "' . __('Normal animation (500ms)', GKTPLNAME) . '", "slow": "' . __('Slow animation (1000ms)', GKTPLNAME) . '" } } }' : '') . ' ] } ]'; // parse the generated JSON $output .= $parser->generateForm($temp_json, true); } return $output; }
<div id="gkTabsContent"> <?php foreach ($tabs as $tab) { ?> <?php if ($tab[2] == 'enabled') { ?> <div<?php if ($contentIterator == $activeTab) { echo ' class="active"'; } ?> > <?php echo $parser->generateForm($tab[1]); ?> <div class="gkSaveSettings"> <img src="<?php echo site_url(); ?> /wp-admin/images/wpspin_light.gif" class="gkAjaxLoading" alt="Loading"> <button class="button-primary gkSave" data-loading="<?php _e('Saving…', GKTPLNAME); ?> " data-loaded="<?php _e('Save settings', GKTPLNAME); ?> " data-wrong="<?php _e('Please check the form!', GKTPLNAME);