Posts made by Joseph Rézeau

Picture of Core developers Picture of Plugin developers Picture of Testers Picture of Translators

@MarkAntony,

First of all I suppose you have carefully followed all the steps in Sara's report in the bug tracker at MDL-69087 especially point 4: Access to "Site administration / Appearance / Themes / Theme selector" and choose "H5PMod" as Default theme.

In YOURMOODLE\theme\h5pmod\renderers.php

public function h5p_alter_styles(&$styles, $libraries, $embedType) {
        global $CFG;
        if (
            isset($libraries['H5P.InteractiveVideo']) &&
            $libraries['H5P.InteractiveVideo']['majorVersion'] == '1'
            
        ) {
            $styles[] = (object) array(
                'path'    => $CFG->httpswwwroot . '/theme/h5pmod/style/custom.css',
                'version' => '?ver=0.0.1',
            );
        };        
        
        if (
            isset($libraries['H5P.Dialogcards']) &&
            $libraries['H5P.Dialogcards']['majorVersion'] == '1'
        ) {
            $styles[] = (object) array(
                'path'    => $CFG->httpswwwroot . '/theme/h5pmod/style/custom.css',
                'version' => '?ver=0.0.1',
            );
        };

...

}

In YOURMOODLE\theme\h5pmod/style/custom.css (for example)

.h5p-dialogcards .h5p-dialogcards-card-content {
    background-color: lightcyan;
}

Result:

 

Picture of Core developers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Oliver!

I think I've got the hang of this h5p_alter_styles function. And I got it to work for most of the H5P content types, except for DialogCards (and my own DialogCardspapiJo version, based on DC).

Strange finding, even when H5P.DialogCards library is present in the $libraries parameter, it is not acknowledged by isset($libraries['H5P.DialogCards']) as shown in this output:

public function h5p_alter_styles(&$styles, $libraries, $embedType) {
        global $CFG;       
        echo'<pre>';
        print_r($libraries);
        echo'</pre>';
        echo 'isset(Audio) = '. isset($libraries['H5P.Audio']) .'<br>';
        echo 'isset(DialogCards) = '. isset($libraries['H5P.DialogCards']) .'<br>';

Gives this output (I have cut out parts of the display)

I have even tried replacing the isset() PHP with array_key_exists(), but it still does not recognize the presence of H5P.DialogCards in the $libraries array. I get:

isset(Audio) = 1
array_key_exists(Audio) = 1
isset(DialogCards) =
array_key_exists(DialogCards) =

Any idea? I suspect a bug...