You are here

function open_readspeaker_library_info_build in Open ReadSpeaker 8

Implements hook_library_info_build().

File

./open_readspeaker.module, line 34
Contains open_readspeaker.module.

Code

function open_readspeaker_library_info_build() {
  $libraries = [];
  $config = Drupal::config('open_readspeaker.settings');
  $libraryUrl = $config
    ->get('open_readspeaker_url');
  if (empty($libraryUrl)) {
    $logger = \Drupal::logger('open_readspeaker');
    $logger
      ->notice('ReadSpeaker URL can not be empty. Please add in Open ReadSpeaker configuration');
    return $libraries;
  }
  $libraryTokenized = Drupal::token()
    ->replace($libraryUrl);
  $libraries['basic'] = [
    'version' => '1.0.x',
    'js' => [
      $libraryTokenized => [
        'type' => 'external',
        'minified' => TRUE,
      ],
    ],
    'dependencies' => [
      'core/jquery',
      'core/drupalSettings',
    ],
  ];
  return $libraries;
}