You are here

function simplemeta_page_bottom in Simple Meta 8

Same name and namespace in other branches
  1. 8.2 simplemeta.module \simplemeta_page_bottom()

Implements hook_page_bottom().

File

./simplemeta.module, line 47
Contains simplemeta.module.

Code

function simplemeta_page_bottom(array &$page_bottom) {
  if (($entity = simplemeta_get_page_meta()) && ($data = $entity
    ->get('data')
    ->get(0)) && ($data = $data
    ->getValue())) {
    foreach ($data as $key => $value) {
      $element = [
        '#tag' => 'meta',
        '#attributes' => [
          'name' => $key,
          'content' => $value,
        ],
      ];
      $page_bottom['simplemeta'][$key]['#attached']['html_head'][] = [
        $element,
        $key,
      ];
    }
  }
}