Пример #1
0
 function form($instance)
 {
     gantry_import('core.config.gantryform');
     global $gantry;
     $defaults = $this->_defaults;
     $gantry->addScript('mootools.js');
     $instance = wp_parse_args((array) $instance, $defaults);
     foreach ($instance as $variable => $value) {
         ${$variable} = GantryWidget::_cleanOutputVariable($variable, $value);
         $instance[$variable] = ${$variable};
     }
     $this->_values = $instance;
     $form = GantryForm::getInstance($this, $this->short_name, $this->short_name);
     $form->bind($this->_values);
     ob_start();
     $fieldSets = $form->getFieldsets();
     foreach ($fieldSets as $name => $fieldSet) {
         ?>
         <fieldset class="panelform">
         <?php 
         foreach ($form->getFieldset($name) as $field) {
             ?>
             <div class="field-wrapper">
             <?php 
             echo $field->label;
             ?>
             <?php 
             echo $field->input;
             ?>
             </div>
         <?php 
         }
         ?>
         </fieldset>
         <?php 
     }
     echo ob_get_clean();
 }
Пример #2
0
$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";
}
Пример #3
0
 public function getGantryForm()
 {
     gantry_import('core.config.gantryform');
     gantry_import('core.config.gantryformnaminghelper');
     $pk = !empty($pk) ? $pk : (int) $this->getState('template.id');
     $item = $this->getItem($pk);
     $item->params['current_id'] = $pk;
     if (!isset($this->_formCache[$pk])) {
         $form = GantryForm::getInstance(GantryFormNamingHelper::getInstance(), 'template-options', 'template-options', array(), true, "//form");
         $form->bind($item->params);
         $this->_formCache[$pk] = $form;
     }
     return $this->_formCache[$pk];
 }
Пример #4
0
 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();
 }