/** * * 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 DynamoWPFormParser($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', DPTPLNAME) . ' ' . $menu->name . '", "tooltip": "' . __('You can enable or disable showing the menu in the template.', DPTPLNAME) . '", "default": "Y", "other": { "options": { "Y": "' . __('Enabled', DPTPLNAME) . '", "N": "' . __('Disabled', DPTPLNAME) . '", "rule": "' . __('Conditional rule', DPTPLNAME) . '" } } }, { "name": "navigation_menu_staterule_' . $menu->location . '", "type": "Text", "label": "' . __('Conditional rule', DPTPLNAME) . '", "tooltip": "' . __('You can enable showing the menu in the specific pages.', DPTPLNAME) . '", "default": "", "class": "", "visibility": "navigation_menu_state_' . $menu->location . '=rule" }, { "name": "navigation_menu_depth_' . $menu->location . '", "type": "Select", "label": "' . __('Depth of ', DPTPLNAME) . ' ' . $menu->name . '", "tooltip": "' . __('You can specify the menu depth.', DPTPLNAME) . '", "default": "0", "other": { "options": { "0": "' . __('All levels', DPTPLNAME) . '", "1": "1", "2": "2", "3": "3", "4": "4", "5": "5" } } } ] } ]'; // parse the generated JSON $output .= $parser->generateForm($temp_json, true); } return $output; }
<div id="dpTabsContent"> <?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="dpSaveSettings"> <img src="<?php echo site_url(); ?> /wp-admin/images/wpspin_light.gif" class="dpAjaxLoading" alt="Loading"> <button class="button-primary dpSave" data-loading="<?php _e('Saving…', DPTPLNAME); ?> " data-loaded="<?php __('Save settings', DPTPLNAME); ?> " data-wrong="<?php __('Please check the form!', DPTPLNAME);