html5shiv-8.x-1.1/html5shiv.module
html5shiv.module
<?php
/**
* @file
* Contains html5shiv.module.
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function html5shiv_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.html5shiv':
$output = '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('The core asset library core/html5shiv is deprecated in Drupal 8.8 and removed in Drupal 9. This module provides the same asset library for any sites which need to continue to support older browsers.') . '</p>';
$output .= '<p>' . t('For more information about the deprecation of html5shiv, see this <a href=":change-record">change record</a>', [':change-record' => 'https://www.drupal.org/node/3086383']) . '</p>';
$output .= '<p>' . t('Visit the <a href=":project_link">html5shiv project page</a> on Drupal.org for more information about this module.', [':project_link' => 'https://www.drupal.org/project/html5shiv']) . '</p>';
return $output;
}
}
/**
* Implements hook_page_attachments_alter().
*/
function html5shiv_page_attachments_alter(array &$attachments) {
if (isset($attachments['#attached']['library'])) {
// Remove html5shiv if it was attached to the page.
$index = array_search('core/html5shiv', $attachments['#attached']['library']);
if ($index !== FALSE) {
unset($attachments['#attached']['library'][$index]);
}
}
}
/**
* Implements hook_element_info_alter().
*/
function html5shiv_element_info_alter(array &$info) {
if (isset($info['html']['#attached']['library'])) {
$index = array_search('core/html5shiv', $info['html']['#attached']['library']);
if ($index !== FALSE) {
unset($info['html']['#attached']['library'][$index]);
}
}
$info['html']['#attached']['library'][] = 'html5shiv/html5shiv';
}
