From 6959f65022ca2b217d6ae0a614ce799a9f5e1101 Mon Sep 17 00:00:00 2001 From: Paal Joergensen Date: Mon, 27 Aug 2018 14:53:17 +0200 Subject: [PATCH] HFP-1871 Add library config as a generic feature --- h5p.classes.php | 8 ++++++++ js/h5p.js | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/h5p.classes.php b/h5p.classes.php index 511bf5b..134ffdb 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -108,6 +108,14 @@ interface H5PFrameworkInterface { */ public function loadAddons(); + /** + * Load config for libraries + * + * @param array $libraries + * @return array + */ + public function getLibraryConfig($libraries = NULL); + /** * Get a list of the current installed libraries * diff --git a/js/h5p.js b/js/h5p.js index f10df8f..38f6022 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -2242,6 +2242,17 @@ H5P.createTitle = function (rawTitle, maxLength) { H5P.externalDispatcher.trigger('datainclipboard', {reset: false}); }; + /** + * Get config for a library + * + * @param string machineName + * @return Object + */ + H5P.getLibraryConfig = function (machineName) { + var hasConfig = H5PIntegration.libraryConfig && H5PIntegration.libraryConfig[machineName]; + return hasConfig ? H5PIntegration.libraryConfig[machineName] : {}; + }; + /** * Get item from the H5P Clipboard. *