JS and CSS not loaded if site base url is not a regular one

Created on 5 March 2025, about 2 months ago

Problem/Motivation

The JS and CSS files of term reference tree are not loaded if Drupal site's base url is not a regular one (like https://mysite.com).

Steps to reproduce

In a devel environment my site is set up as follows: https://mysite.com:30443/subsite/web/
The term reference tree module is working if it is moved in a https://mysite.com environment.
There are no errors in the console, but the JS and CSS files are not loaded.

Proposed resolution

Might be related with this issue, although I am not sure:
https://www.drupal.org/project/term_reference_tree/issues/3238208

💬 Support request
Status

Active

Version

2.0

Component

Miscellaneous

Created by

🇮🇪Ireland marksmith

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

Comments & Activities

  • Issue created by @marksmith
  • 🇮🇪Ireland marksmith

    In an environment like the one suggested above, I could get the module working only if the css and js libraries were attached explicitely. So I had to modify the term_reference_tree.module file by adding the following code:

    function term_reference_tree_page_attachments(array &$attachments) {
      $attachments['#attached']['library'][] = 'term_reference_tree/term_reference_tree_js';
      $attachments['#attached']['library'][] = 'term_reference_tree/term_reference_tree_css';
    }
Production build 0.71.5 2024