SyncPropertyForm: remove late-fixing of elements...

...everything is ready now once we reach setup()
This commit is contained in:
Thomas Gelf 2015-07-28 11:47:37 +02:00
parent 3192700d3a
commit 4a1cdd093c
1 changed files with 10 additions and 25 deletions

View File

@ -10,13 +10,15 @@ class SyncPropertyForm extends DirectorObjectForm
public function setup() public function setup()
{ {
$this->addElement('select', 'rule_id', array( $this->addElement('select', 'rule_id', array(
'label' => $this->translate('Rule Name'), 'label' => $this->translate('Rule Name'),
'required' => true, 'multiOptions' => $this->optionalEnum($this->db->enumSyncRule()),
'required' => true,
)); ));
$this->addElement('select', 'source_id', array( $this->addElement('select', 'source_id', array(
'label' => $this->translate('Source Name'), 'label' => $this->translate('Source Name'),
'required' => true, 'multiOptions' => $this->optionalEnum($this->db->enumImportSource()),
'required' => true,
)); ));
$this->addElement('text', 'source_expression', array( $this->addElement('text', 'source_expression', array(
@ -46,28 +48,11 @@ class SyncPropertyForm extends DirectorObjectForm
'description' => $this->translate('Whether you want to merge or override the destination field'), 'description' => $this->translate('Whether you want to merge or override the destination field'),
'required' => true, 'required' => true,
'multiOptions' => array( 'multiOptions' => array(
'null' => '- please choose -', 'null' => '- please choose -',
'merge' => 'merge', 'merge' => 'merge',
'override' => 'override' 'override' => 'override'
) )
)); ));
} }
public function loadObject($id)
{
parent::loadObject($id);
return $this;
}
public function setDb($db)
{
parent::setDb($db);
$this->prepareElements();
$this->getElement('rule_id')->setMultiOptions($this->optionalEnum($db->enumSyncRule()));
$this->getElement('source_id')->setMultiOptions($this->optionalEnum($db->enumImportSource()));
return $this;
}
} }