Commit 64d9201b authored by paalj's avatar paalj

Added hook invoked after H5P library install

parent 4fd52986
......@@ -96,4 +96,17 @@ function hook_h5p_scripts_alter(&$scripts, $libraries, $mode) {
}
}
/**
* Hook is invoked whenever an H5P library has been installed/updated. It is created
* to be able to run other actions, not to alter input data.
*
* @param array $libraryData
* This associative array contains everything found in library.json
* @param boolean $isNew
* If this is a new library, this will be TRUE, otherwise FALSE
*/
function hook_h5p_library_installed($libraryData, $isNew) {
$machineName = $libraryData['machineName'];
}
?>
......@@ -335,6 +335,12 @@ class H5PDrupal implements H5PFrameworkInterface {
$libraryData['majorVersion'] . '.' . $libraryData['minorVersion']
);
// Invoke h5p_library_installed hook for each library that has
// been installed
if (sizeof(module_implements('h5p_library_installed')) > 0) {
module_invoke_all('h5p_library_installed', $libraryData, $new);
}
db_delete('h5p_libraries_languages')
->condition('library_id', $libraryData['libraryId'])
->execute();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment