diff --git a/library/Icinga/Web/Form.php b/library/Icinga/Web/Form.php
index b05bd8c55..37aa44e23 100644
--- a/library/Icinga/Web/Form.php
+++ b/library/Icinga/Web/Form.php
@@ -119,6 +119,13 @@ class Form extends Zend_Form
*/
protected $protectIds = true;
+ /**
+ * The cue that is appended to each element's label if it's required
+ *
+ * @var string
+ */
+ protected $requiredCue = '*';
+
/**
* Authentication manager
*
@@ -406,6 +413,29 @@ class Form extends Zend_Form
return $this->protectIds;
}
+ /**
+ * Set the cue to append to each element's label if it's required
+ *
+ * @param string $cue
+ *
+ * @return Form
+ */
+ public function setRequiredCue($cue)
+ {
+ $this->requiredCue = $cue;
+ return $this;
+ }
+
+ /**
+ * Return the cue being appended to each element's label if it's required
+ *
+ * @return string
+ */
+ public function getRequiredCue()
+ {
+ return $this->requiredCue;
+ }
+
/**
* Create this form
*
@@ -604,10 +634,10 @@ class Form extends Zend_Form
if ($element->isRequired() && strpos(strtolower($element->getType()), 'checkbox') === false) {
$element->setAttrib('aria-required', 'true'); // ARIA
$element->setAttrib('required', ''); // HTML5
- if (($label = $element->getDecorator('label')) !== false) {
+ if (($cue = $this->getRequiredCue()) !== null && ($label = $element->getDecorator('label')) !== false) {
$element->setLabel($this->getView()->escape($element->getLabel()));
$label->setOption('escape', false);
- $label->setOption('requiredSuffix', ' *');
+ $label->setOption('requiredSuffix', sprintf(' %s', $cue));
}
}