Reputation: 288
Hope this isn't really obvious. I am creating a select element, with multiple options, each option has a mathematical symbol in it.
A simplified version:
<select name="comparison" class="form-control filter-field toggle-display" data-replace-id="from-value"><option value="1">=</option>
<option value="2">&gt;</option>
<option value="3">&lt;</option>
<option value="4">x &#8804; b &#8804; y</option>
</select>
As you can see the escapeHtmlHelper is doing it job and escaping my html codes. It looks like the is no setting to stop this behaviour and I will need to override the renderOptions method with one of my own, is this correct?
Below is the select creation code
$filter_model = new \Application\Model\Filter();
$value_options = $filter_model->getOptions();
$this->add(array(
'name' => 'comparison',
'type' => '\Zend\Form\Element\Select',
'attributes' => array(
'class' => 'form-control filter-field toggle-display',
'data-replace-id' => 'from-value',
/*'escape' => false,*/
),
'options' => array(
'value_options' => $value_options,
),
));
Filter getOptions:
public function getOptions()
{
return array(
self::$EQUALS => '=',
self::$GREATER_THAN => '>',
self::$LESS_THAN => '<',
self::$BETWEEN => "x ≤ b ≤ y",
);
}
Abor.
Upvotes: 0
Views: 461
Reputation: 33148
The HTML sample you posted shows symbols that have been double-escaped. Just make sure the symbols in $value_options
are not already escaped and your code should work fine.
Upvotes: 1