function forward_page_attachments in Forward 4.0.x
Same name and namespace in other branches
- 8.3 forward.module \forward_page_attachments()
- 8 forward.module \forward_page_attachments()
- 8.2 forward.module \forward_page_attachments()
- 4.x forward.module \forward_page_attachments()
Implements hook_page_attachments().
File
- ./
forward.module, line 31 - 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();
// Tell SEO to ignore this page on request.
if ($settings['forward_form_noindex']) {
$element = [
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => [
'name' => 'robots',
'content' => 'noindex, nofollow',
],
];
$page['#attached']['html_head'][] = [
$element,
'forward_meta_noindex',
];
}
}
}