H5PMod : Apply to all h5p libraries
Submitted by pymoz on Tue, 11/13/2018 - 22:19
Forums:
Hello,
I'm looking for code that will apply custom.css to all the H5P libraries that are installed in Moodle.
The default code below only add custom.css to interative video :
Thank you!
public function hvp_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', ); } } /** * Add scripts when an H5P is displayed. * * @param object $scripts Scripts that will be applied. * @param array $libraries Libraries that will be displayed. * @param string $embedType How the H5P is displayed. */ public function hvp_alter_scripts(&$scripts, $libraries, $embedType) { global $CFG; if ( isset($libraries['H5P.InteractiveVideo']) && $libraries['H5P.InteractiveVideo']['majorVersion'] == '1' ) { $include_file = ($embedType === 'editor' ? 'customEditor.js' : 'custom.js'); $scripts[] = (object) array( 'path' => $CFG->httpswwwroot . '/theme/h5pmod/js/' . $include_file, 'version' => '?ver=0.0.1', ); } }
icc
Thu, 11/15/2018 - 09:40
Permalink
You should be able to do so
You should be able to do so by changing the code to this:
pymoz
Thu, 11/15/2018 - 15:55
Permalink
Wow
Thank you! It's working.