Add/alter html head tags

Public

Replacement for D7 drupal_add_html_head()

</> CopyGet raw version
php
  1. function THEME_page_attachments_alter(array &$page) {
  2. $viewport = array(
  3. '#type' => 'html_tag',
  4. '#tag' => 'meta',
  5. '#attributes' => array(
  6. 'name' => 'viewport',
  7. 'content' => 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no',
  8. ),
  9. );
  10. $page['#attached']['html_head'][] = [$viewport, 'viewport'];
  11. }