function fb_instant_articles_page_attachments_alter in Facebook Instant Articles 3.x
Same name and namespace in other branches
- 8.2 fb_instant_articles.module \fb_instant_articles_page_attachments_alter()
- 8 fb_instant_articles.module \fb_instant_articles_page_attachments_alter()
Implements hook_page_attachments_alter().
File
- ./
fb_instant_articles.module, line 70 - Contains fb_instant_articles.module..
Code
function fb_instant_articles_page_attachments_alter(array &$page) {
$config = \Drupal::config('fb_instant_articles.settings');
$path_matcher = \Drupal::service('path.matcher');
if ($path_matcher
->isFrontPage() && ($page_id = $config
->get('page_id'))) {
$meta_page_id = [
'#tag' => 'meta',
'#attributes' => [
'property' => 'fb:pages',
'content' => $page_id,
],
];
$page['#attached']['html_head'][] = [
$meta_page_id,
'fia_pagesid',
];
}
}