jquery_migrate-8.x-1.0/jquery_migrate.module

jquery_migrate.module
<?php

/**
 * @file
 * Contains jquery_migrate.module.
 */

use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Implements hook_help().
 */
function jquery_migrate_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    // Main module help for the jquery_migrate module.
    case 'help.page.jquery_migrate':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('jQuery Migrate 3.x restores the APIs that were removed in the jQuery 3.x. Without it the breaking changes introduced by jQuery 3.x may break the site.') . '</p>';
      return $output;

    default:
  }
}

/**
 * Implements hook_library_info_alter().
 */
function jquery_migrate_library_info_alter(&$libraries, $extension) {
  // Update jQuery 3.x dependencies.
  if ($extension == 'core' && isset($libraries['jquery'])) {
    // Verify existing version is 3.x.
    $version = $libraries['jquery']['version'];
    if (version_compare($version, '3.0', '>=') && version_compare($version, '4.0', '<')) {
      // Add the jQuery Migrate 3.x as a dependency of jQuery 3.x.
      $libraries['jquery']['dependencies'][] = 'jquery_migrate/jquery.migrate';
    }
  }
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc