Esempio n. 1
0
 /**
  * Module properties form.
  *
  * @param PageModuleWrapper $pageModuleWrapper
  * @return Curry_Form
  */
 public static function getModulePropertiesForm(PageModuleWrapper $pageModuleWrapper)
 {
     $form = new Curry_Form(array('action' => url('', $_GET), 'method' => 'post', 'elements' => array('pid_moduleproperties' => array('hidden'), 'name' => array('text', array('label' => 'Name', 'required' => true, 'value' => $pageModuleWrapper->getPageModule()->getName(), 'description' => 'The name of this module. If you have many modules of the same type on the same page this will help you to seperate them from each other.')), 'target' => array('text', array('label' => 'Target', 'description' => 'Specifies what variable in the page-template to attach this module to.', 'required' => true, 'value' => $pageModuleWrapper->getTarget())), 'content_visibility' => array('select', array('label' => 'Content Visibility', 'description' => 'Set the visibility of this module in the Content backend module.', 'multiOptions' => PageModulePeer::$contentVisiblityOptions, 'value' => $pageModuleWrapper->getPageModule()->getContentVisibility(), 'required' => true)), 'search_visibility' => array('checkbox', array('label' => 'Search Visibility', 'description' => 'If this module should be rendered when indexing pages.', 'value' => $pageModuleWrapper->getPageModule()->getSearchVisibility(), 'required' => true)))));
     $showSelect = array("true" => "Yes", "false" => "No");
     $defaultTemplate = $pageModuleWrapper->isInherited() ? "[ Inherit ]" : "[ None ]";
     $template = $pageModuleWrapper->getModuleData()->getTemplate();
     $templatesSelect = Curry_Backend_Template::getTemplateSelect();
     if ($template && !array_key_exists($template, $templatesSelect)) {
         $templatesSelect[$template] = $template . ' <MISSING!>';
     }
     $form->addSubForm(new Curry_Form_SubForm(array('legend' => $pageModuleWrapper->isInherited() ? 'Override inherited settings' : 'Inherited settings', 'elements' => array('template' => $pageModuleWrapper->hasTemplate() ? array('select', array('label' => 'Template', 'multiOptions' => array(null => $defaultTemplate) + $templatesSelect, 'value' => $template)) : array('select', array('label' => 'Template', 'multiOptions' => array("None"), 'disabled' => 'disabled')), 'show' => array('select', array('label' => 'Show', 'multiOptions' => $pageModuleWrapper->isInherited() ? array('' => "[ Inherit ]") + $showSelect : $showSelect, 'value' => self::bool2str($pageModuleWrapper->getModuleData()->getEnabled())))))), 'local');
     $form->addElement('submit', 'save', array('label' => 'Save'));
     return $form;
 }