I need to set an attribute for form with single quotes inside the value.
Now I have this code:
private function getForm($options) {
$form = $this->modules->get('InputfieldForm');
$form->action = isset($options['action']) ? $options['action'] : './';
$form->method = 'post';
$form->attr([
'id+name' => 'contact-form',
'onsubmit' => "ym(53558719, 'reachGoal', 'form_question'); return true;"
]);
...
}
But on the frontend there is an output:
<form id="contact-form" class="form js-simplecontactform InputfieldForm" name="contact-form" method="post" action="./#question" onsubmit="ym(53558719, 'reachGoal', 'form_question'); return true;" data-colspacing="1">
Backslashes before single quotes don't help. The quotes turn into '
What should I do?