DirectorObjectForm: add store/delete button helper

This commit is contained in:
Thomas Gelf 2015-10-15 23:51:29 +02:00
parent b376527c44
commit dc41842118
1 changed files with 14 additions and 0 deletions

View File

@ -301,6 +301,20 @@ abstract class DirectorObjectForm extends QuickForm
return $this;
}
protected function setButtons()
{
if ($this->object === null || ! $this->object->hasBeenLoadedFromDb()) {
$this->setSubmitLabel(
$this->translate('Add')
);
} else {
$this->setSubmitLabel(
$this->translate('Store')
);
$this->addDeleteButton();
}
}
protected function addField($field, $value = null, $inherited = null, $inheritedFrom = null)
{
$datafield = DirectorDatafield::load($field->datafield_id, $this->getDb());