You are here

function socialblue_library_info_alter in Open Social 8.8

Same name and namespace in other branches
  1. 8.9 themes/socialblue/socialblue.theme \socialblue_library_info_alter()

Implements hook_library_info_alter().

File

themes/socialblue/socialblue.theme, line 22
The primary PHP file for the Social Blue theme.

Code

function socialblue_library_info_alter(&$libraries, $extension) {

  // Add extra CSS files if specific style is chosen.
  $style = theme_get_setting('style');
  if (!empty($style) && $extension === 'socialblue') {
    $theme_path = drupal_get_path('theme', $extension);
    $base_path = 'assets/css/';
    foreach ($libraries as $key => $library) {
      $style_css = $base_path . $key . '--' . $style . '.css';
      if (file_exists($theme_path . '/' . $style_css)) {
        $libraries[$key]['css']['theme'][$style_css] = [];
        $libraries[$key]['css']['theme'][$style_css]['weight'] = 600;
      }
    }

    // Add extra JS for secondary navigation in Sky style.
    if ($style === 'sky') {
      $libraries['navbar']['js']['assets/js/navbar-secondary--sky.min.js'] = [];
    }
  }
}