From 668233fb955517d6d3496a4afd7566faa0150546 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Fri, 11 Oct 2019 20:37:58 +0800 Subject: [PATCH] Allow the dependency path to be overridden by child classes This allows an implementor to choose how the library is served. --- h5p.classes.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/h5p.classes.php b/h5p.classes.php index 6eb3c3e..503bdea 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -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) { + return 'libraries/' . H5PCore::libraryToString($dependency, TRUE); + } + private static function getDependenciesHash(&$dependencies) { // Build hash of dependencies $toHash = array();