Skip to content

Commit

Permalink
Merge pull request #70 from kalamuna/8.x-2.x--remove-favicons
Browse files Browse the repository at this point in the history
Remove favicons
  • Loading branch information
Derek DeRaps authored Sep 29, 2017
2 parents d0fca28 + 48b44b3 commit 6b73e88
Showing 1 changed file with 0 additions and 102 deletions.
102 changes: 0 additions & 102 deletions kalastatic.module
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ function kalastatic_library_info_build() {
function kalastatic_page_attachments(array &$attachments) {
// Attach library to page.
$attachments['#attached']['library'][] = 'kalastatic/css-js';

// Add favicon tags to head.
_kalastatic_favicons($attachments);
}

/**
Expand Down Expand Up @@ -248,102 +245,3 @@ function kalastatic_page_attachments_alter(array &$page) {
}
}

/**
* Add favicon tags to the head.
*/
function _kalastatic_favicons(array &$attachments) {
// Pull the brand color from saved settings.
$config = \Drupal::config('kalastatic.settings');
$brand_color = $config->get('kalastatic_brand_color');

// Get kalastatic.yaml settings so we can find the images.
$settings = kalastatic_get_settings();
$dest = '/' . $settings['destination'];

// Set up tags for the favicons.
$apple_touch_icon = [
'#type' => 'html_tag',
'#tag' => 'link',
'#attributes' => [
'href' => $dest . '/images/favicon/apple-touch-icon.png',
'rel' => 'apple-touch-icon',
'sizes' => '180x180',
],
];
$attachments['#attached']['html_head'][] = [$apple_touch_icon, 'apple_touch_icon'];

$favicon_32x32 = [
'#type' => 'html_tag',
'#tag' => 'link',
'#attributes' => [
'href' => $dest . '/images/favicon/favicon-32x32.png',
'rel' => 'icon',
'sizes' => '32x32',
'type' => 'image/png',
],
];
$attachments['#attached']['html_head'][] = [$favicon_32x32, 'favicon_32x32'];

$favicon_16x16 = [
'#type' => 'html_tag',
'#tag' => 'link',
'#attributes' => [
'href' => $dest . '/images/favicon/favicon-16x16.png',
'rel' => 'icon',
'sizes' => '16x16',
'type' => 'image/png',
],
];
$attachments['#attached']['html_head'][] = [$favicon_16x16, 'favicon_16x16'];

$manifest = [
'#type' => 'html_tag',
'#tag' => 'link',
'#attributes' => [
'href' => $dest . '/images/favicon/manifest.json',
'rel' => 'manifest',
],
];
$attachments['#attached']['html_head'][] = [$manifest, 'manifest'];

$mask_icon = [
'#type' => 'html_tag',
'#tag' => 'link',
'#attributes' => [
'href' => $dest . '/images/favicon/safari-pinned-tab.svg',
'rel' => 'mask-icon',
'color' => $brand_color,
],
];
$attachments['#attached']['html_head'][] = [$mask_icon, 'mask-icon'];

$shortcut_icon = [
'#type' => 'html_tag',
'#tag' => 'link',
'#attributes' => [
'href' => $dest . '/images/favicon/favicon.ico',
'rel' => 'shortcut icon',
],
];
$attachments['#attached']['html_head'][] = [$shortcut_icon, 'shortcut icon'];

$msapplication_config = [
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => [
'href' => $dest . '/images/favicon/browserconfig.xml',
'name' => 'msapplication-config',
],
];
$attachments['#attached']['html_head'][] = [$msapplication_config, 'msapplication_config'];

$theme_color = [
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => [
'content' => $brand_color,
'name' => 'theme-color',
],
];
$attachments['#attached']['html_head'][] = [$theme_color, 'theme_color'];
}

0 comments on commit 6b73e88

Please sign in to comment.