- 🇳🇨New Caledonia satane
Hi. Looked into this during Drupal South 2023 code sprint, but as previsouly commented we need more information.
Not sure in what context this happens, so I tried to reproduce within a module on 11.0-dev (in custom block configuration and build, as well as in configuration forms), but it always worked as expected (HTML tags stick when using #markup). - 🇩🇪Germany Anybody Porta Westfalica
I'll have a try again with Drupal 10.1! brb
- Status changed to Closed: duplicate
over 1 year ago 7:06am 25 May 2023 - 🇩🇪Germany Anybody Porta Westfalica
Thank you very much for taking a look! I just checked this in Drupal 10.0.9 (related code is equal to 11.x currently) and it still doesn't work.
I tried the implementation from the issue summary and from #4 / #5 and in both cases the content was removed!
With just text ("TITLE TEST") in
#title
the result was:<li class="horizontal-tab-button horizontal-tab-button-0 first selected" tabindex="-1" data-horizontaltabbutton="0"> <a href="#edit-field-paragraph-settings-0-style-spacing--fZq0LuuXqC4"> <strong>TITLE TEST</strong> <span class="summary"></span> <span id="active-horizontal-tab" class="visually-hidden">(aktiver Reiter)</span> </a> </li>
With HTML in the title ("
<i>TITLE TEST</i>
") in#title
the result was:<li class="horizontal-tab-button horizontal-tab-button-0 first selected" tabindex="-1" data-horizontaltabbutton="0"> <a href="#edit-field-paragraph-settings-0-style-spacing--fZq0LuuXqC4"> <strong></strong> <span class="summary"></span> <span id="active-horizontal-tab" class="visually-hidden">(aktiver Reiter)</span> </a> </li>
(note the empty
<strong></strong>
)
Both the same using just #title or #title with #markup within (#4 / #5)My suggestion is, that the HTML is not stripped in PHP, but in the JavaScript when building the tabs.
Finally I found the important missing piece -.-
$element['style'] = [ '#type' => 'horizontal_tabs', '#theme_wrappers' => ['horizontal_tabs'], '#title' => $this->t('Style'), '#tree' => TRUE, ];
(added this to the IS now!)
So it's not a core issue, but a field_group module issue and already reported for various field_group types!
So I created a meta issue to sum that up and get things fixed at field_group: 🐛 [META] Fix HTML escaping issues ActiveClosing this as duplicate, thank you all so much and sorry.
- 🇩🇪Germany Anybody Porta Westfalica
Moving the issue over to Field Group where it belongs.