You are here

function jquery_carousel_themes in jQuery carousel 8

Same name and namespace in other branches
  1. 7 jquery_carousel.module \jquery_carousel_themes()

Retrieves a list of all available jQuery Carousel themes.

2 calls to jquery_carousel_themes()
jquery_carousel_config_form in ./jquery_carousel.module
Helper function to create config form. Reusable for field formatter & views.
_jquery_carousel_include_css_js in ./jquery_carousel.module
Helper function to inject required Css & Js.

File

./jquery_carousel.module, line 313
Provide jquery carousel style plugin for views.

Code

function jquery_carousel_themes() {
  $themes =& drupal_static(__FUNCTION__);

  // Don't rebuild if we already have a list of themes.
  if (isset($themes)) {
    return $themes;
  }

  // Build a list of themes from other modules.
  $themes = [];
  foreach (\Drupal::moduleHandler()
    ->getImplementations('carousel_theme_info') as $module) {
    $function = $module . '_carousel_theme_info';
    $module_themes = $function();
    foreach ($module_themes as $key => $theme) {
      $theme['module'] = $module;
      $theme['file path'] = isset($theme['file path']) ? $theme['file path'] : drupal_get_path('module', $module);
      $theme['title'] = isset($theme['title']) ? $theme['title'] : $key;
      $themes[$key] = $theme;
    }
  }
  ksort($themes);
  return $themes;
}