Description
I have added some JavaScript functionality to the backend, and for that I used <script type="text/x-magento-init"></script>
. This worked fine in 2.0.7, but in 2.1 this stopped working.
I've added it with after_element_html
when creating the form:
$fieldset->addField(
'my_field',
'textarea',
[
'name' => 'my_field',
'label' => __('My Field'),
'title' => __('My Field'),
'after_element_html' => '(some HTML, ending with the script-tag)'
]
);
This worked fine in 2.0.7, but in 2.1 this stopped working. When I look at the source, I simply see the raw <script>
-tag there, that otherwise would have been replaced.
Now I assume my approach (misusing after_element_html
to insert an entire HTML-blob) isn't the most elegant, but it worked. Until the 2.1 update.
Can anyone point me in the right direction why this stopped working or how I should implement it otherwise?
a small footnote: the html included and the JavaScript are all knockout-based. Could that have something to do with it? Since knockout is now already throwing errors on my custom html, which makes sense of course.