You are here

function tacjs_library_info_build in TacJS 8.5

Same name and namespace in other branches
  1. 8.6 tacjs.module \tacjs_library_info_build()
  2. 8.3 tacjs.module \tacjs_library_info_build()
  3. 8.4 tacjs.module \tacjs_library_info_build()

Implements hook_library_info_build().

Add tarteaucitron translations dynamically.

File

./tacjs.module, line 41
The main file for the TacJS module.

Code

function tacjs_library_info_build() {
  $libraries = [];

  /** @var \Drupal\Core\File\FileSystemInterface $fileSystem */
  $fileSystem = Drupal::service('file_system');
  foreach ($fileSystem
    ->scanDirectory(drupal_get_path('module', 'tacjs') . '/assets/vendor/tarteaucitron.js/lang/', '/tarteaucitron\\.(\\w+)\\.js/') as $file) {
    $libraries[$file->filename] = [
      'js' => [
        '/' . $file->uri => [],
      ],
    ];
  }
  return $libraries;
}