You are here

function responsive_favicons_page_attachments_alter in Responsive Favicons 8

Implements hook_page_attachments_alter().

Remove the stock Drupal favicon if it is present.

File

./responsive_favicons.module, line 60
Contains responsive_favicons.module.

Code

function responsive_favicons_page_attachments_alter(array &$attachments) {
  $config = \Drupal::config('responsive_favicons.settings');
  if ($config
    ->get('remove_default') && isset($attachments['#attached']['html_head_link'])) {
    foreach ($attachments['#attached']['html_head_link'] as $key => $config) {
      if (isset($config[0]['rel']) && $config[0]['rel'] === 'shortcut icon') {
        unset($attachments['#attached']['html_head_link'][$key]);
      }
    }
  }
}