Skip to content

Instantly share code, notes, and snippets.

@RainbowArray
Created January 27, 2016 20:03
Show Gist options
  • Save RainbowArray/e63dfd34943fdefdf80a to your computer and use it in GitHub Desktop.
Save RainbowArray/e63dfd34943fdefdf80a to your computer and use it in GitHub Desktop.
Change meta viewport tag in D8
<?php
/**
* Implements hook_preprocess_HOOK() for HTML document templates.
*/
function THEMENAME_preprocess_html(&$variables) {
foreach ($variables['page']['#attached']['html_head'] as $key => $value) {
if ($value[1] === 'viewport') {
$value[0]['#attributes']['content'] = 'width=device-width,minimum-scale=1,initial-scale=1';
$variables['page']['#attached']['html_head'][$key] = $value;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment