예제 #1
0
파일: Helper.php 프로젝트: Umz/ImpressPages
 public static function pluginPropertiesForm($pluginName)
 {
     $form = new \Ip\Form();
     $form->setEnvironment(\Ip\Form::ENVIRONMENT_ADMIN);
     $field = new \Ip\Form\Field\Hidden(array('name' => 'aa', 'value' => 'Plugins.updatePlugin'));
     $form->addField($field);
     $field = new \Ip\Form\Field\Hidden(array('name' => 'pluginName', 'value' => $pluginName));
     $form->addField($field);
     $initialFieldCount = count($form->getFields());
     $form = ipFilter('ipPluginPropertiesForm', $form, array('pluginName' => $pluginName));
     if (count($form->getFields()) == $initialFieldCount) {
         return null;
     }
     $field = new \Ip\Form\Field\Submit(array('value' => __('Save', 'Ip-admin')));
     $field->addClass('ipsSave');
     $form->addField($field);
     return $form;
 }
예제 #2
0
 /**
  * @param string $name
  * @return \Ip\Form
  * @throws \Ip\Exception
  */
 public function getThemeConfigForm($name)
 {
     $model = Model::instance();
     $theme = $model->getTheme($name);
     if (!$theme) {
         throw new \Ip\Exception("Theme doesn't exist");
     }
     $form = new \Ip\Form();
     $form->setEnvironment(\Ip\Form::ENVIRONMENT_ADMIN);
     $form->addClass('ipsForm');
     $options = $theme->getOptions();
     $generalFieldset = $this->getFieldset($name, $options);
     $generalFieldset->setLabel(__('General options', 'Ip-admin'));
     if (count($generalFieldset->getFields())) {
         $form->addFieldset($generalFieldset);
     }
     foreach ($options as $option) {
         if (empty($option['type']) || empty($option['options'])) {
             continue;
         }
         if ($option['type'] != 'group') {
             continue;
         }
         $fieldset = $this->getFieldset($name, $option['options']);
         if (!empty($option['label'])) {
             $fieldset->setLabel($option['label']);
         }
         $form->addFieldset($fieldset);
     }
     $form->addFieldset(new \Ip\Form\Fieldset());
     $field = new Form\Field\Hidden();
     $field->setName('aa');
     $field->setValue('Design.updateConfig');
     $form->addField($field);
     return $form;
 }