You are here

function forward_page_attachments in Forward 8.2

Same name and namespace in other branches
  1. 8.3 forward.module \forward_page_attachments()
  2. 8 forward.module \forward_page_attachments()
  3. 4.x forward.module \forward_page_attachments()
  4. 4.0.x forward.module \forward_page_attachments()

Implements hook_page_attachments().

File

./forward.module, line 35
Allows forwarding of entities by email.

Code

function forward_page_attachments(array &$page) {
  if (\Drupal::routeMatch()
    ->getRouteName() == 'forward.form') {
    $settings = \Drupal::config('forward.settings')
      ->get();
    if ($settings['forward_interface_type'] == 'link') {

      // Tell SEO to ignore this page on request.
      if ($settings['forward_link_noindex']) {
        $element = [
          '#type' => 'html_tag',
          '#tag' => 'meta',
          '#attributes' => [
            'name' => 'robots',
            'content' => 'noindex, nofollow',
          ],
        ];
        $page['#attached']['html_head'][] = [
          $element,
          'forward_meta_noindex',
        ];
      }
    }
  }
}