5 * Custom hook implementations for Metatag Favicons.
8 use Drupal\Core\Routing\RouteMatchInterface;
11 * Implements hook_help().
13 function metatag_favicons_help($route_name, RouteMatchInterface $route_match) {
14 switch ($route_name) {
15 // Main module help for the metatag_favicons module.
16 case 'help.page.metatag_favicons':
18 $output .= '<h3>' . t('About') . '</h3>';
19 $output .= '<p>' . t('Provides support for many different favicons.') . '</p>';
27 * Implements hook_page_attachments_alter().
29 function metatag_favicons_page_attachments_alter(array &$attachments) {
30 // Check html_head_link on attached tags in head.
31 if (!isset($attachments['#attached']['html_head_link'])) {
35 // Remove the default shortcut icon if one was set by Metatag.
36 foreach ($attachments['#attached']['html_head'] as $element) {
37 if (isset($element[1]) && $element[1] == 'shortcut_icon') {
38 foreach ($attachments['#attached']['html_head_link'] as $key => $value) {
39 if (isset($value[0]['rel']) && $value[0]['rel'] == 'shortcut icon') {
40 unset($attachments['#attached']['html_head_link'][$key]);