You are here

function select2_library_info_build in Select 2 8

Implements hook_library_info_build().

File

./select2.module, line 52
This is the Select2 module.

Code

function select2_library_info_build() {
  $libraries = [];
  foreach (\Drupal::languageManager()
    ->getLanguages() as $language) {
    if (file_exists('libraries/select2/dist/js/i18n/' . $language
      ->getId() . '.js')) {
      $libraries['select2.i18n.' . $language
        ->getId()] = [
        'js' => [
          '/libraries/select2/dist/js/i18n/' . $language
            ->getId() . '.js' => [
            'minified' => TRUE,
          ],
        ],
        'dependencies' => [
          'select2/select2',
        ],
      ];
    }
  }
  return $libraries;
}