You are here

function fontyourface_library_info_build in @font-your-face 8.3

Implements hook_library_info_build().

File

./fontyourface.module, line 60
Contains fontyourface.module..

Code

function fontyourface_library_info_build() {
  $libraries = [];
  $drupal_themes = \Drupal::service('theme_handler')
    ->listInfo();
  foreach ($drupal_themes as $key => $theme) {
    $styles = FontDisplay::loadByTheme($key);
    if (!empty($styles)) {
      foreach ($styles as $style) {
        $file_url = file_build_uri('fontyourface/font_display/' . $style
          ->id() . '.css');
        $libraries['font_display_' . $key]['css']['base'][$file_url] = [
          'basename' => $file_url,
        ];
      }
    }
  }
  return $libraries;
}