You are here

protected function CookiesConfigService::libraryExists in COOKiES Consent Management 1.0.x

Tests if the Cookies JSR library is installed in the correct folder.

Return value

bool Test result if the library is installed correct.

1 call to CookiesConfigService::libraryExists()
CookiesConfigService::getLibrary in src/Services/CookiesConfigService.php
Returns the library to use (cdn or from library folder).

File

src/Services/CookiesConfigService.php, line 140

Class

CookiesConfigService
Services to handle module config and method for a rendered documentation.

Namespace

Drupal\cookies\Services

Code

protected function libraryExists() {
  $lib = $this->libraryDiscovery
    ->getLibraryByName('cookies', 'cookiesjsr');
  if (!$lib) {
    return FALSE;
  }
  foreach ($lib['js'] as $js_file) {
    if (isset($js_file['data']) && $js_file['data']) {
      return file_exists(DRUPAL_ROOT . '/' . $js_file['data']);
    }
  }
  return FALSE;
}