jquery_deprecated_functions-1.0.1/src/Hook/JqueryDeprecatedFunctionsHooks.php
src/Hook/JqueryDeprecatedFunctionsHooks.php
<?php
namespace Drupal\jquery_deprecated_functions\Hook;
use Drupal\Core\Hook\Attribute\Hook;
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Class JqueryDeprecatedFunctionsHooks that implements the hooks.
*/
class JqueryDeprecatedFunctionsHooks {
/**
* Implements hook_help().
*/
#[Hook('help')]
public function help($route_name, RouteMatchInterface $route_match): ?string {
switch ($route_name) {
case 'help.page.jquery_deprecated_functions':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('This is a small module that implements some deprecated jQuery functions like: <strong>$.trim</strong>, <strong>$.isFunction</strong>, <strong>$.camelCase</strong> and many more functions, objects and constants that were deprecated in jQuery 4. ')
. t('It is worth to mention that Drupal 11 uses jQuery 4 and most of the widgets that relied on older jQuery releases are not working any more, so this module is temporary solution for that.') . '<br />'
. t('To submit bug reports and feature suggestions, or track changes, visit the <a href=":link">project issue page</a>.', [':link' => 'https://www.drupal.org/project/issues/jquery_deprecated_functions']) . '</p>';
return $output;
}
return NULL;
}
/**
* Implements hook_page_attachments().
*/
#[Hook('page_attachments')]
public function jqueryDeprecatedFunctionsPageAttachments(array &$page): void {
$page['#attached']['library'][] = 'jquery_deprecated_functions/global-scripts';
}
}
