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(
'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. ' .

View File

@ -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)