/** * @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; }