You are here

public function WebformLibrariesManager::isExcluded in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/WebformLibrariesManager.php \Drupal\webform\WebformLibrariesManager::isExcluded()

Determine if library is excluded.

Parameters

string $name: The name of the library.

Return value

bool TRUE if library is excluded.

Overrides WebformLibrariesManagerInterface::isExcluded

2 calls to WebformLibrariesManager::isExcluded()
WebformLibrariesManager::isIncluded in src/WebformLibrariesManager.php
Determine if library is included.
WebformLibrariesManager::requirements in src/WebformLibrariesManager.php
Get third party libraries status for hook_requirements and drush.

File

src/WebformLibrariesManager.php, line 297

Class

WebformLibrariesManager
Webform libraries manager.

Namespace

Drupal\webform

Code

public function isExcluded($name) {
  $excluded_libraries = $this
    ->getExcludedLibraries();
  if (empty($excluded_libraries)) {
    return FALSE;
  }
  if (isset($excluded_libraries[$name])) {
    return TRUE;
  }
  if (strpos($name, 'libraries.') !== 0 && strpos($name, 'webform/libraries.') !== 0) {
    return FALSE;
  }
  $parts = explode('.', preg_replace('#^(webform/)?libraries.#', '', $name));
  while ($parts) {
    if (isset($excluded_libraries[implode('.', $parts)])) {
      return TRUE;
    }
    array_pop($parts);
  }
  return FALSE;
}