- Issue created by @cristiroma
- First commit to issue fork.
Following on ✨ Configure script to load from CDN Active I think we can improve the module usability by simply detecting if the library is present in the system locally, and use it instead of CDN.
/**
* Implements hook_library_info_alter().
*/
function ckeditor_tippy_library_info_alter(&$libraries, $extension) {
if ($extension == 'ckeditor_tippy' && file_exists(DRUPAL_ROOT . '/libraries/popper/popper.js')) {
if (isset($libraries['plugin.scroll_effects.build']['dependencies'])
&& ($dependency_key = array_search('ckeditor_tippy/popper.remote', $libraries['plugin.scroll_effects.build']['dependencies'])) !== FALSE) {
unset($libraries['plugin.ckeditor_tippy.build']['dependencies'][$dependency_key]);
$libraries['plugin.ckeditor_tippy.build']['dependencies'][] = 'ckeditor_tippy/popper.local';
}
}
}
Active
1.0
Code