Allow the dependency path to be overridden by child classes

This allows an implementor to choose how the library is served.
pull/68/head
Andrew Nicols 2019-10-11 20:37:58 +08:00
parent 9a658ba387
commit 34bc10184d
1 changed files with 11 additions and 1 deletions

View File

@ -2432,7 +2432,7 @@ class H5PCore {
// Using content dependencies
foreach ($dependencies as $dependency) {
if (isset($dependency['path']) === FALSE) {
$dependency['path'] = 'libraries/' . H5PCore::libraryToString($dependency, TRUE);
$dependency['path'] = $this->getDependencyPath($dependency);
$dependency['preloadedJs'] = explode(',', $dependency['preloadedJs']);
$dependency['preloadedCss'] = explode(',', $dependency['preloadedCss']);
}
@ -2452,6 +2452,16 @@ class H5PCore {
return $files;
}
/**
* Get the path to the dependency.
*
* @param array $dependency
* @return string
*/
protected function getDependencyPath(array $dependency): string {
return 'libraries/' . H5PCore::libraryToString($dependency, TRUE);
}
private static function getDependenciesHash(&$dependencies) {
// Build hash of dependencies
$toHash = array();