Skip to content

Issue #3547091: Update deprecated 'system.css_js_query_string' method when making cache bust parameter

Closes #3547091

Problem

In Drupal 11, H5P JavaScript and CSS assets are not properly cache busted due to the deprecated system.css_js_query_string state always returning '0'. This results in URLs like /modules/contrib/h5p/vendor/h5p/h5p-core/js/h5p-event-dispatcher.js?0= where the cache parameter is always the same. This prevents effective cache busting and can lead to users loading outdated assets.

Changes

  • Replaced all deprecated \Drupal::state()->get('system.css_js_query_string', '0') calls with the modern \Drupal::service('asset.query_string')->get() service across four files.

Technical Details

  • This fix does not maintain compatibility with unsupported Drupal releases older than 10.2.

Testing

Drupal 11

  • Rendered H5P field uses correct cache bust param
    • Open browser developer tools → Network tab
    • Visit any node with an H5P field
    • Observe that H5P JS/CSS files now have unique cache parameters instead of ?0=
  • Repeat the test above using an embed link (e.g., /h5p/217/embed, where the middle number is the entity id of the H5P).
  • Repeat the test when editing a node with an H5P field.

Drupal 10

  • Repeat the rendered node with H5P field test
  • Repeat the H5P embed link test
  • Repeat the H5P editor test

Merge request reports

Loading