You are here

protected function WebformLibrariesManager::initExcludedLibraries in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/WebformLibrariesManager.php \Drupal\webform\WebformLibrariesManager::initExcludedLibraries()

Initialize excluded libraries.

Return value

array A key array containing excluded libraries.

1 call to WebformLibrariesManager::initExcludedLibraries()
WebformLibrariesManager::getExcludedLibraries in src/WebformLibrariesManager.php
Get excluded libraries.

File

src/WebformLibrariesManager.php, line 504

Class

WebformLibrariesManager
Webform libraries manager.

Namespace

Drupal\webform

Code

protected function initExcludedLibraries() {

  // Get excluded optional libraries.
  if ($excluded_libraries = $this->configFactory
    ->get('webform.settings')
    ->get('libraries.excluded_libraries')) {
    $excluded_libraries = array_combine($excluded_libraries, $excluded_libraries);
  }
  else {
    $excluded_libraries = [];
  }

  // Get excluded libraries based on excluded (element) types.
  $libraries = $this
    ->getLibraries();
  foreach ($libraries as $library_name => $library) {
    if (!empty($library['elements']) && $this
      ->areElementsExcluded($library['elements'])) {
      $excluded_libraries[$library_name] = $library_name;
    }
  }
  return $excluded_libraries;
}