Score:0

How can I customize the "H5P - Create and Share Rich Content and Applications" module?

cn flag

I need to modify the behavior of the H5P - Create and Share Rich Content and Applications module in Drupal 8, but (as far as I can see) there is a description of the hooks used from the Drupal 7 version of the module. There isn't a similar file for the Drupal 8 version.

What hooks should I use for the Drupal 8 version of the module? If the module doesn't use hooks, how can I customize the module?

Score:4
us flag

All the hooks listed in the h5p.api.php file for the Drupal 7 version are still supported from the Drupal 8 version. The Drupal 8 branch doesn't have a h5p.api.php file to document the used hooks, but the code invokes the same hooks. See the following list, which reports where each hook is invoked.

  • hook_h5p_semantics_alter(): src/H5PDrupal/H5PDrupal.php

    $version = $majorVersion . '.'. $minorVersion;
    \Drupal::moduleHandler()->alter('h5p_semantics', $semantics, $name, $version);
    
  • hook_h5p_filtered_params_alter(): src/H5PDrupal/H5PDrupal.php

    $moduleHandler = \Drupal::moduleHandler();
    $filteredAsJson = json_decode($filteredParameters);
    $moduleHandler->alter('h5p_filtered_params', $filteredAsJson);
    
  • hook_h5p_styles_alter() and hook_h5p_scripts_alter(): src/Controller/H5PEmbed.php

    $mode = 'external';
    \Drupal::moduleHandler()->alter('h5p_scripts', $files['scripts'], $library_list, $mode);
    \Drupal::moduleHandler()->alter('h5p_styles', $files['styles'], $library_list, $mode);
    
  • hook_h5p_library_installed(): src/H5PDrupal/H5PDrupal.php

    \Drupal::moduleHandler()->invokeAll('h5p_library_installed', array($libraryData, $new));
    
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.