[icinga-checkins] icinga.org: icingaweb2-module-director/master: QuickBaseForm: allow translation tools find 'None'

git at icinga.org git at icinga.org
Tue Oct 25 04:39:55 CEST 2016


Module: icingaweb2-module-director
Branch: master
Commit: 0791b900f35a95d7cbc5a6bedd84a06214a712cd
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=0791b900f35a95d7cbc5a6bedd84a06214a712cd

Author: Thomas Gelf <thomas at gelf.net>
Date:   Fri Oct 21 20:58:28 2016 +0000

QuickBaseForm: allow translation tools find 'None'

---

 application/forms/IcingaServiceForm.php     |    2 +-
 library/Director/Web/Form/QuickBaseForm.php |   10 ++++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/application/forms/IcingaServiceForm.php b/application/forms/IcingaServiceForm.php
index 99d9c8a..142228d 100644
--- a/application/forms/IcingaServiceForm.php
+++ b/application/forms/IcingaServiceForm.php
@@ -284,7 +284,7 @@ class IcingaServiceForm extends DirectorObjectForm
             $this->addElement('select', 'apply_for', array(
                 'label' => $this->translate('Apply For'),
                 'class' => 'assign-property autosubmit',
-                'multiOptions' => $this->optionalEnum($hostProperties, 'None'),
+                'multiOptions' => $this->optionalEnum($hostProperties, $this->translate('None')),
                 'description' => $this->translate(
                     'Evaluates the apply for rule for ' .
                     'all objects with the custom attribute specified. ' .
diff --git a/library/Director/Web/Form/QuickBaseForm.php b/library/Director/Web/Form/QuickBaseForm.php
index ee48d02..4ea5330 100644
--- a/library/Director/Web/Form/QuickBaseForm.php
+++ b/library/Director/Web/Form/QuickBaseForm.php
@@ -72,11 +72,13 @@ abstract class QuickBaseForm extends Zend_Form
         return $this;
     }
 
-    public function optionalEnum($enum, $text='- please choose -')
+    public function optionalEnum($enum, $nullLabel = null)
     {
-        return array(
-            null => $this->translate($text)
-        ) + $enum;
+        if ($nullLabel === null) {
+            $nullLabel = $this->translate('- please choose -');
+        }
+
+        return array(null => $nullLabel) + $enum;
     }
 
     protected function handleOptions($options = null)



More information about the icinga-checkins mailing list