DirectorObjectForm: add and use isNew helper

This commit is contained in:
Thomas Gelf 2016-03-17 01:42:57 +01:00
parent 8ce323bde1
commit 0119e0f4a2
1 changed files with 6 additions and 1 deletions

View File

@ -396,9 +396,14 @@ abstract class DirectorObjectForm extends QuickForm
}
}
protected function isNew()
{
return $this->object === null || ! $this->object->hasBeenLoadedFromDb();
}
protected function setButtons()
{
if ($this->object === null || ! $this->object->hasBeenLoadedFromDb()) {
if ($this->isNew()) {
$this->setSubmitLabel(
$this->translate('Add')
);