You are here

function field_group_library_info_alter in Field Group 8.3

Implements hook_library_info_alter().

File

./field_group.module, line 39
Allows administrators to attach field groups.

Code

function field_group_library_info_alter(&$libraries, $extension) {

  // Swap jQuery.ui library if available.
  // See https://www.drupal.org/project/field_group/issues/3109552 for more
  // background on the logic.
  if ($extension == 'field_group') {
    if (\Drupal::moduleHandler()
      ->moduleExists('jquery_ui_accordion')) {
      $libraries['formatter.accordion']['dependencies'] = [
        'jquery_ui_accordion/accordion',
      ];
    }
    elseif (version_compare(\Drupal::VERSION, 9) > 0) {
      $libraries['formatter.accordion']['js'] = [];
      $libraries['formatter.accordion']['dependencies'] = [];
    }
  }
}