QuickBaseForm: allow translation tools find 'None'

This commit is contained in:
Thomas Gelf 2016-10-21 20:58:28 +00:00
parent b00d3b4943
commit 0791b900f3
2 changed files with 7 additions and 5 deletions

View File

@ -284,7 +284,7 @@ class IcingaServiceForm extends DirectorObjectForm
$this->addElement('select', 'apply_for', array( $this->addElement('select', 'apply_for', array(
'label' => $this->translate('Apply For'), 'label' => $this->translate('Apply For'),
'class' => 'assign-property autosubmit', 'class' => 'assign-property autosubmit',
'multiOptions' => $this->optionalEnum($hostProperties, 'None'), 'multiOptions' => $this->optionalEnum($hostProperties, $this->translate('None')),
'description' => $this->translate( 'description' => $this->translate(
'Evaluates the apply for rule for ' . 'Evaluates the apply for rule for ' .
'all objects with the custom attribute specified. ' . 'all objects with the custom attribute specified. ' .

View File

@ -72,11 +72,13 @@ abstract class QuickBaseForm extends Zend_Form
return $this; return $this;
} }
public function optionalEnum($enum, $text='- please choose -') public function optionalEnum($enum, $nullLabel = null)
{ {
return array( if ($nullLabel === null) {
null => $this->translate($text) $nullLabel = $this->translate('- please choose -');
) + $enum; }
return array(null => $nullLabel) + $enum;
} }
protected function handleOptions($options = null) protected function handleOptions($options = null)