Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By tnfno on
I am making a D8 site where I have some pages that will have Angular javascript to do some updates. The html for these pages are made in a custom module that also adds the JS. The problem is that some tags like <button>
are beeing stripped away from the html code. I can of course do some creative JS replacement, but I am sure there is a way to do this properly.
The render array:
public function myFunc() {
$myFunc = new \Drupal\myModule\myFunction;
$html = $myFunc->makeMyHtml();
return [
'#type' => 'markup',
'#markup' => $html
];
}
I thought that the type 'markup' would pass more or less untouched, but <button>
tags are removed.
Comments
Solved
Search and you will find. http://drupal.stackexchange.com/questions/184963/pass-raw-html-to-markup solved it.