Can no longer insert / override CSS since update to 2.0.0-alpha5

Created on 23 May 2025, 2 months ago

Problem/Motivation

We have for some years now been overriding H5P styling in Drupal 8, 9, and 10 using a simple custom module that splices in some extra CSS and we have been able to re-style H5P interactions very successful significantly.

The custom module was very simple...

function custom_h5p_overrides_h5p_styles_alter(&$styles, $libraries, $mode) {
  $styles[] = (object) [
    // Path relative to drupal root
    'path' => \Drupal::service('extension.list.module')->getPath('custom_h5p_overrides') . '/css/custom-h5p-overrides.min.css','version' => '?ver=1'
  ];
}

For example, we re-style a multiple choice question like this...

But since updating to 2.0.0-alpha5, the custom CSS deems no longer to be applied and we are right back where we started...

Can anyone please help us to understand what has changed here and why this very long-standing and reliable method no longer works?

Many thanks

💬 Support request
Status

Active

Version

2.0

Component

Code

Created by

🇬🇧United Kingdom SirClickALot Somerset

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

Comments & Activities

  • Issue created by @SirClickALot
  • 🇩🇪Germany filburt

    Hi,

    you could try the following - worked for me:

    function custom_h5p_overrides_h5p_styles_alter(array &$styles, array $libraries, string $mode): void {
    ...
    }

  • Have the same issue in both 2.0.0-alpha5 and 2.0.0-alpha6. #2 did not work for me.
    Debugging shows that the hook is not being called. Worked in D10 alpha4.

  • 🇬🇧United Kingdom SirClickALot Somerset

    @anzi31, Agreed, the hook is simply not being called and #2 could not really make any difference.

    We do love H5P for educational project but forward-compatibility of this module just does not seem to me to be going to happen so we are finding ourselves look around for other alternatives.

  • Looks like \Drupal::moduleHandler()->alter() was removed from H5PDefaultFormatter.php.
    If you embed a quiz, it works, but if it is an iframe, it does not.

  • Uploaded the wrong file.

Production build 0.71.5 2024