Assets / Attachments from Tokens used in tabs are not loading

Created on 9 January 2023, almost 2 years ago
Updated 29 June 2023, over 1 year ago

I have a page with Boostrap Horizontal Tabs.

In one tab I have a custom token, for example [my:custom:token]

The content renders OK, but none of the assets are attached (such as library). It looks like the render array ['#attached'] that is in custom hook_tokens function is not being included.

It appears that it is being lost in BootstrapHorizontalTabs.php so I changed the below...

<?php
    foreach ($items as $delta => $item) {
      $elements['#items'][$delta] = [
        'header' => $item->header,
        'body' => check_markup($item->body_value, $item->body_format),
        'id' => preg_replace('/[^a-z0-9_]+/', '_', strtolower($item->header)),
      ];
    }
?>

and removed the 'check_markup' to...

<?php
    foreach ($items as $delta => $item) {
      $elements['#items'][$delta] = [
        'header' => $item->header,
        'body' => [
          '#type' => 'processed_text',
          '#text' => $item->body_value,
          '#format' => $item->body_format,
        ],
        'id' => preg_replace('/[^a-z0-9_]+/', '_', strtolower($item->header)),
      ];
    }
?>

And library assets now load with the page. Can someone please advise?

πŸ› Bug report
Status

Closed: outdated

Version

2.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom tce

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Status changed to Closed: outdated over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States mark_fullmer Tucson

    Since the changes proposed are present in the 2.x version of this module, I'm going to close this as "outdated."

Production build 0.71.5 2024