Skip to content

Commit

Permalink
Merge pull request #68 from andrewnicols/libraryPathSubclass
Browse files Browse the repository at this point in the history
Allow the dependency path to be overridden by child classes
  • Loading branch information
thomasmars authored Oct 31, 2019
2 parents 541f6d8 + 34bc101 commit 4256810
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion h5p.classes.php
Original file line number Diff line number Diff line change
Expand Up @@ -2432,7 +2432,7 @@ public function getDependenciesFiles($dependencies, $prefix = '') {
// 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']);
}
Expand All @@ -2452,6 +2452,16 @@ public function getDependenciesFiles($dependencies, $prefix = '') {
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();
Expand Down

0 comments on commit 4256810

Please sign in to comment.