You are here

function mediaelement_preprocess_html in MediaElement 8

Implements hook_preprocess_html().

File

./mediaelement.module, line 34
Primary module file.

Code

function mediaelement_preprocess_html(&$variables) {
  $config = \Drupal::config('mediaelement.settings');
  $global_config = $config
    ->get('global_settings');
  $settings = mediaelement_parse_config($global_config);
  if ($settings['attachSitewide']) {
    $library = "mediaelement/mediaelement_{$config->get('library_settings.library_source')}";
    $variables['#attached']['library'][] = $library;
  }
  $variables['#attached']['drupalSettings']['mediaelement'] = $settings;
}