Exemplo n.º 1
0
 /**
  * Construct this form
  * @param string $action url where this form will point to
  * @param joppa\model\Theme $theme the theme for which a region has to be selected
  * @param string $region optional name of a region to preselect
  * @return null
  */
 public function __construct($action, Theme $theme, $region = null)
 {
     parent::__construct($action, self::NAME);
     $regions = array();
     $themeRegions = $theme->getRegions();
     foreach ($themeRegions as $name => $themeRegion) {
         $regions[$name] = $themeRegion->getName();
     }
     $factory = FieldFactory::getInstance();
     $field = $factory->createField(FieldFactory::TYPE_LIST, self::FIELD_REGION, $region);
     $field->setAttribute('onchange', 'this.form.submit()');
     $field->setOptions($regions);
     $field->addEmpty('---', '');
     $this->addField($field);
 }