Set default Library in selector (drupal 8)
Submitted by ymdahi on Wed, 11/20/2019 - 19:05
Forums:
I'd like to set the default library = "Interactive Video" and hide the "Content Type" selector or hub.
In a custom module, I can get my JS to run once the library has been chosen from the Select list:
function h5pmods_h5p_scripts_alter(&$scripts, & $libraries, $mode) { if ($mode == 'editor') { $styles[] = (object) array( 'path' => drupal_get_path('module', 'h5pmods') . '/h5p-editor-overrides.js', 'version' => '?ver=1', ); } }
However, I cannot find a way to run my JS when the Selector/Hub is loaded (only after the Editor is loaded).
Something like this would be helpful:
function h5pmods_h5p_scripts_alter(&$scripts, & $libraries, $mode) { if ($mode == 'library-select') { $styles[] = (object) array( 'path' => drupal_get_path('module', 'h5pmods') . '/my-script.js', 'version' => '?ver=1', ); } }
Ultimately, my goal is to:
- Only allow Interactive Videos to be created.
- Set Interactive Video as the default option for the Editor.
- Continue to allow other Content Types (like text and multichoice) to be created within the interactive video.
Many thanks for your help!
ymdahi
Wed, 11/20/2019 - 19:33
Permalink
I see what's happening now:
I see what's happening now:
$mode == editor is true when the editor is loaded. I am attempting to run some JS before the editor loaded. Specifically, I'd like to run JS that selects "Interactive Video" as the Library (in other words: set Interactive Video as the default Library).
ymdahi
Fri, 05/01/2020 - 17:44
Permalink
Any help on this would be
Any help on this would be greatly appreciated.
Allowing a default content type would be useful for many use cases.