Discuss putting scripts/styles to be loaded in extra json file in H5P core
Description
The PHP part of H5P core ( ) defines certain scripts and styles that should be loaded. PHP based H5P integrations will make use of these directly and automatically register changes when a new version of H5P core gets released that added/removes scripts/styles, e.g. for the upcoming theming change.
H5P integrations that are not PHP based (e.g. Lumi or the H5P CLI tool) will have to rely on a respective port of H5P core that reflects the same changes or they will have to add the changes directly.
In order to improve the developer experience, it feels useful to put the paths of scripts and styles into a separate JSON file in H5P core (similar to how library.json files define what styles/scripts need to be loaded for an H5P content library). Instead of using hardcoded lists of scripts/styles in PHP, H5P integrations could fetched these from the JSON file which could be used by non-PHP based H5P integrations as well.
There may be other static variables like the core major/minor version, the filetype extensions that are allowed by default, etc. (in h5p.classes.php), etc. which could also benefit from not being hardcoded in PHP, but put in the/a JSON file.
Acceptance Criteria
None
Activity
Andrei Busuioc September 2, 2024 at 10:15 AM
Great idea! This can be implemented as an extension to the existing user config functionality.
The PHP part of H5P core ( ) defines certain scripts and styles that should be loaded. PHP based H5P integrations will make use of these directly and automatically register changes when a new version of H5P core gets released that added/removes scripts/styles, e.g. for the upcoming theming change.
H5P integrations that are not PHP based (e.g. Lumi or the H5P CLI tool) will have to rely on a respective port of H5P core that reflects the same changes or they will have to add the changes directly.
In order to improve the developer experience, it feels useful to put the paths of scripts and styles into a separate JSON file in H5P core (similar to how library.json files define what styles/scripts need to be loaded for an H5P content library). Instead of using hardcoded lists of scripts/styles in PHP, H5P integrations could fetched these from the JSON file which could be used by non-PHP based H5P integrations as well.
There may be other static variables like the core major/minor version, the filetype extensions that are allowed by default, etc. (in h5p.classes.php), etc. which could also benefit from not being hardcoded in PHP, but put in the/a JSON file.