You are here

public function WebformLibrariesManager::exists in Webform 6.x

Determine if a library's directory exist.

Parameters

string $name: The library's directory name.

Return value

bool TRUE if the library's directory exist.

Overrides WebformLibrariesManagerInterface::exists

1 call to WebformLibrariesManager::exists()
WebformLibrariesManager::requirements in src/WebformLibrariesManager.php
Get third party libraries status for hook_requirements and drush.

File

src/WebformLibrariesManager.php, line 220

Class

WebformLibrariesManager
Webform libraries manager.

Namespace

Drupal\webform

Code

public function exists($name) {

  // @todo Inject dependency once Drupal 8.9.x is only supported.
  if (\Drupal::hasService('library.libraries_directory_file_finder')) {
    return \Drupal::service('library.libraries_directory_file_finder')
      ->find($name) ? TRUE : FALSE;
  }
  else {
    return file_exists(DRUPAL_ROOT . '/libraries/' . $name);
  }
}