You are here

function easymeta_preprocess_html in Easymeta 8

Implements hook_preprocess_html().

File

./easymeta.module, line 72
Contains easy_meta.module.

Code

function easymeta_preprocess_html(&$variables) {
  $current_path = \Drupal::service('path.current')
    ->getPath();
  $current_language = \Drupal::languageManager()
    ->getCurrentLanguage()
    ->getId();
  $meta = new Meta($current_language, $current_path);
  $meta_values = $meta
    ->getValue();
  if (isset($meta_values['title']['value'])) {
    unset($variables['head_title']['name']);
    $variables['head_title']['title'] = $meta_values['title']['value'];
  }
}