From 0119e0f4a2b4b4531aac534ed4a11e054716ae67 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 17 Mar 2016 01:42:57 +0100 Subject: [PATCH] DirectorObjectForm: add and use isNew helper --- library/Director/Web/Form/DirectorObjectForm.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/library/Director/Web/Form/DirectorObjectForm.php b/library/Director/Web/Form/DirectorObjectForm.php index 5225462d..3ca82bad 100644 --- a/library/Director/Web/Form/DirectorObjectForm.php +++ b/library/Director/Web/Form/DirectorObjectForm.php @@ -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') );