You are here

function maestro_template_builder_library_info_build in Maestro 8.2

Same name and namespace in other branches
  1. 3.x modules/maestro_template_builder/maestro_template_builder.module \maestro_template_builder_library_info_build()

Implements hook_library_info_build().

File

modules/maestro_template_builder/maestro_template_builder.module, line 29
Provides Drupal hooks used in Maestro.

Code

function maestro_template_builder_library_info_build() {
  $config = \Drupal::config('maestro_template_builder.settings');
  if ($config
    ->get('maestro_template_builder_local_library')) {
    $libraries['maestro_raphael'] = [
      'js' => [
        '/libraries/raphael/raphael.js' => [],
        'js/template-display.js' => [],
      ],
      'dependencies' => [
        'core/jquery',
        'core/drupal',
        'core/drupalSettings',
        'core/jquery.once',
        'core/drupal.dialog.ajax',
      ],
    ];
  }
  else {
    $default = $config
      ->get('maestro_template_builder_remote_library_location');
    $cdn = isset($default) ? $default : '//cdnjs.cloudflare.com/ajax/libs/raphael/2.2.7/raphael.js';
    $libraries['maestro_raphael'] = [
      'js' => [
        $cdn => [
          'external' => TRUE,
        ],
        'js/template-display.js' => [],
      ],
      'dependencies' => [
        'core/jquery',
        'core/drupal',
        'core/drupalSettings',
        'core/jquery.once',
        'core/drupal.dialog.ajax',
      ],
    ];
  }
  return $libraries;
}