DirectorDataField: whether a field is required...

...is a setting
This commit is contained in:
Thomas Gelf 2016-12-07 09:43:16 +01:00
parent 2ea573e338
commit 1acf332f6b
1 changed files with 3 additions and 6 deletions

View File

@ -29,8 +29,6 @@ class DirectorDatafield extends DbObjectWithSettings
protected $settingsRemoteId = 'datafield_id';
private $required = false;
private $object;
public static function fromDbRow($row, Db $connection)
@ -56,10 +54,6 @@ class DirectorDatafield extends DbObjectWithSettings
return $this->object;
}
protected function setRequired($value)
{
$this->required = (bool) $value;
}
public function getFormElement(DirectorObjectForm $form, $name = null)
{
@ -82,6 +76,9 @@ class DirectorDatafield extends DbObjectWithSettings
$datatype->setSettings($this->getSettings());
$el = $datatype->getFormElement($name, $form);
if ($this->getSetting('is_required') === 'y') {
$el->setRequired(true);
}
if ($caption = $this->get('caption')) {
$el->setLabel($caption);
}