function display($tpl = null) { /** @var $gantry Gantry */ global $gantry; $language = JFactory::getLanguage(); $language->load('com_templates'); $this->item = $this->get('Item'); JHtml::_('behavior.framework', true); require_once JPATH_LIBRARIES . "/gantry/gantry.php"; gantry_import('core.config.gantryform'); GantryForm::addFormPath(JPATH_COMPONENT_ADMINISTRATOR); GantryForm::addFormPath($gantry->templatePath); GantryForm::addFieldPath($gantry->gantryPath . '/admin/forms/fields'); GantryForm::addFieldPath($gantry->templatePath . '/fields'); GantryForm::addFieldPath($gantry->templatePath . '/admin/forms/fields'); GantryForm::addGroupPath($gantry->gantryPath . '/admin/forms/groups'); GantryForm::addGroupPath($gantry->templatePath . '/admin/forms/groups'); $this->state = $this->get('State'); $this->form = $this->get('Form'); $this->override = $this->get('Override'); $this->gantryForm = $this->get('GantryForm'); $this->activeTab = isset($_COOKIE['gantry-admin-tab']) ? $_COOKIE['gantry-admin-tab'] + 1 : 1; $this->tabs = $this->getTabs($this->gantryForm); $this->assignmentCount = $this->getAssignmentCount($this->item->id); $model = $this->getModel(); $model->checkForGantryUpdate(); //$this->addToolbar(); JToolBarHelper::title(''); ob_start(); parent::display($tpl); $buffer = ob_get_clean(); echo $buffer; }
public function form($instance) { gantry_import('core.config.gantryform'); global $gantry; GantryForm::addFieldPath($gantry->gantryPath . '/widgets/gantrymenu/admin/fields'); $themes = self::$themes; foreach ($themes as $theme) { GantryForm::addFormPath($theme['path']); } // TODO see if we need this $gantry->addScript('mootools.js'); $instance = wp_parse_args($instance, $this->getDefaults()); // If no menus exists, direct the user to go and create some. foreach ($instance as $variable => $value) { ${$variable} = self::_cleanOutputVariable($variable, $value); $instance[$variable] = ${$variable}; } $this->_values = $instance; $form = GantryForm::getInstance($this, $this->short_name, $this->short_name); $form->bind($this->_values); $fieldSets = $form->getFieldsets(); $subforms = array(); foreach ($themes as $theme) { $subform = GantryForm::getInstance($this, $theme['name'], $theme['name']); $subform->bind($this->_values); $subforms[$theme['name']] = $subform; } ob_start(); ?> <fieldset class="panelform"> <?php foreach ($fieldSets as $name => $fieldSet) { ?> <?php foreach ($form->getFieldset($name) as $field) { ?> <div class="field-wrapper"> <?php echo $field->label; ?> <?php echo $field->input; ?> </div> <?php } ?> <?php foreach ($subforms as $subform_name => $subform) { ?> <?php foreach ($subform->getFieldset($subform_name) as $field) { ?> <div class="field-wrapper"> <?php echo $field->label; ?> <?php echo $field->input; ?> </div> <?php } ?> <?php } ?> <?php } ?> </fieldset> <?php echo ob_get_clean(); }
$gantry->addScript('mootools.js'); $gantry->addScript($gantry->gantryUrl . '/admin/widgets/gantry.js'); // Setup the JS for the admin $gantry->addInlineScript(gantryLang()); if (file_exists($gantry->templatePath . "/gantry.scripts.php") && is_readable($gantry->templatePath . "/gantry.scripts.php")) { include_once $gantry->templatePath . "/gantry.scripts.php"; if (function_exists('gantry_params_init')) { gantry_params_init(); } } $override_catalog = gantry_get_override_catalog($gantry->templateName); $data = array(); $data['template-options'] = get_option($gantry->templateName . '-template-options'); GantryForm::addFormPath($gantry->templatePath); GantryForm::addFieldPath($gantry->templatePath . '/fields'); GantryForm::addFieldPath($gantry->templatePath . '/admin/forms/fields'); $form = GantryForm::getInstance(GantryTemplateInfo::getInstance(), 'template-options', 'templateDetails', array(), true, '//config'); $form->bind($data); $fieldSets = $form->getFieldsets('template-options'); $form->initialize(); ?> <div id="hack-panel"> <?php $fields = $form->getFullFieldset('toolbar-panel'); foreach ($fields as $name => $field) { $gantry->addDomReadyScript("Gantry.ToolBar.add('" . $field->type . "');"); echo "<div id=\"contextual-" . $field->type . "-wrap\" class=\"hidden contextual-custom-wrap\">\n"; echo "\t\t<div class=\"metabox-prefs\">\n"; echo $field->input; echo "\t\t</div>\n"; echo "</div>\n";
/** * Gets the xml config for all gantry widgets * @return void */ function _getWidgetConfigs() { gantry_import('core.config.gantryform'); $form_paths = array($this->gantryPath . DS . 'widgets', $this->templatePath . DS . 'widgets'); foreach ($form_paths as $form_path) { if (file_exists($form_path) && is_dir($form_path)) { GantryForm::addFormPath($form_path); } } $field_paths = array($this->gantryPath . DS . 'admin/forms/fields', $this->templatePath . DS . 'admin/forms/fields'); foreach ($field_paths as $field_path) { if (file_exists($field_path) && is_dir($field_path)) { GantryForm::addFieldPath($field_path); } } $group_paths = array($this->gantryPath . DS . 'admin/forms/groups', $this->templatePath . DS . 'admin/forms/groups'); foreach ($group_paths as $group_path) { if (file_exists($group_path) && is_dir($group_path)) { GantryForm::addGroupPath($group_path); } } }