You are here

function jquery_calendar_langs in jQuery World Calendars API 3.x

Parameters

$format //flat:

Return value

array

1 call to jquery_calendar_langs()
Demo::buildForm in src/Form/Demo.php
Form constructor.

File

./jquery_calendar.module, line 64
Implements necessary hooks, API and helpers for jQuery World Calendars.

Code

function jquery_calendar_langs($format = NULL) {
  $items = \Drupal::service('library.discovery')
    ->getLibrariesByExtension('jquery_calendar');
  $themes = $format !== 'flat' ? [
    'en' => [
      'core',
      'picker',
      'type-all',
    ],
  ] : [
    'en' => 'en, core, picker, type-all',
  ];
  foreach ($items as $key => $info) {
    if (preg_match('%jquery_calendars\\.lang\\.([^-]+)-([a-z\\-]+)%i', $key, $matches)) {
      if (!isset($themes[$matches[2]])) {
        $themes[$matches[2]] = $format !== 'flat' ? [] : $matches[2] . ':';
      }
      if ($format !== 'flat') {
        $themes[$matches[2]][] = $matches[1];
      }
      else {
        $themes[$matches[2]] .= ' ' . $matches[1];
      }
    }
  }
  return $themes;
}