Update Composer, update everything
This commit is contained in:
parent
ea3e94409f
commit
dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions
|
@ -9,20 +9,50 @@
|
|||
* Implements hook_library_info_alter().
|
||||
*/
|
||||
function webform_library_info_alter(&$libraries, $extension) {
|
||||
// Only alter webform libraries.
|
||||
if ($extension != 'webform') {
|
||||
$webform_libraries_modules = \Drupal::moduleHandler()->getImplementations('webform_libraries_info');
|
||||
$webform_libraries_modules[] = 'webform';
|
||||
|
||||
// Only alter modules that declare webform libraries.
|
||||
// @see hook_webform_libraries_info()
|
||||
if (!in_array($extension, $webform_libraries_modules)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add off-canvas system tray to dialog dependencies.
|
||||
if (isset($libraries['webform.admin.dialog']) && (floatval(\Drupal::VERSION) >= 8.3) && \Drupal::moduleHandler()->moduleExists('outside_in')) {
|
||||
$libraries['webform.admin.dialog']['dependencies'][] = 'outside_in/drupal.off_canvas';
|
||||
$libraries['webform.admin.dialog']['dependencies'][] = 'outside_in/drupal.outside_in';
|
||||
// Prevent duplicate instances of the chosen plugin and use
|
||||
// the chosen_lib.module's as the dependency.
|
||||
if (isset($libraries['webform.element.chosen']) && \Drupal::moduleHandler()->moduleExists('chosen_lib')) {
|
||||
$dependencies =& $libraries['webform.element.chosen']['dependencies'];
|
||||
foreach ($dependencies as $index => $dependency) {
|
||||
if ($dependency === 'webform/libraries.jquery.chosen') {
|
||||
$dependencies[$index] = 'chosen_lib/chosen';
|
||||
$dependencies[] = 'chosen_lib/chosen.css';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** @var \Drupal\webform\WebformLibrariesManagerInterface $libraries_manager */
|
||||
$libraries_manager = \Drupal::service('webform.libraries_manager');
|
||||
|
||||
// Map /library/* paths to CDN.
|
||||
// @see webform.libraries.yml.
|
||||
foreach ($libraries as &$library) {
|
||||
foreach ($libraries as $library_name => &$library) {
|
||||
// Remove excluded libraries.
|
||||
if ($libraries_manager->isExcluded($library_name)) {
|
||||
unset($libraries[$library_name]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!empty($library['dependencies'])) {
|
||||
// Remove excluded libraries from dependencies.
|
||||
foreach ($library['dependencies'] as $dependency_index => $dependency_name) {
|
||||
if ($libraries_manager->isExcluded($dependency_name)) {
|
||||
$library['dependencies'][$dependency_index] = NULL;
|
||||
$library['dependencies'] = array_filter($library['dependencies']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check CDN setting exists.
|
||||
if (!isset($library['cdn'])) {
|
||||
continue;
|
||||
|
@ -58,12 +88,13 @@ function _webform_library_info_alter_recursive(array &$library, array $cdn) {
|
|||
continue;
|
||||
}
|
||||
|
||||
// Replace the CDN sources (ie /library/*) with the CDN URL destination
|
||||
// Replace the CDN sources (i.e. /library/*) with the CDN URL destination
|
||||
// (https://cdnjs.cloudflare.com/ajax/libs/*).
|
||||
foreach ($cdn as $source => $destination) {
|
||||
if (strpos($key, $source) === 0) {
|
||||
$uri = str_replace($source, $destination, $key);
|
||||
$library[$uri] = $value;
|
||||
$library[$uri]['type'] = 'external';
|
||||
unset($library[$key]);
|
||||
break;
|
||||
}
|
||||
|
|
Reference in a new issue