public function CookiesConfigService::getLibraryUrl in COOKiES Consent Management 1.0.x
Returns the URL path from where the library is delivered.
Return value
string Return library URL without file specification (fallback to CDN).
1 call to CookiesConfigService::getLibraryUrl()
- CookiesConfigService::getConfig in src/
Services/ CookiesConfigService.php - Returns the configuration object for Cookies JSR.
File
- src/
Services/ CookiesConfigService.php, line 179
Class
- CookiesConfigService
- Services to handle module config and method for a rendered documentation.
Namespace
Drupal\cookies\ServicesCode
public function getLibraryUrl() {
$libId = explode('/', $this
->getLibrary());
$lib = $this->libraryDiscovery
->getLibraryByName($libId[0], $libId[1]);
foreach ($lib['js'] as $js_file) {
$libUrl = explode('/', $js_file['data']);
array_pop($libUrl);
$base = $libId[1] != 'cookiesjsr.cdn' ? base_path() : '';
return $base . implode('/', $libUrl);
}
return 'https://cdn.jsdelivr.net/gh/jfeltkamp/cookiesjsr@1/dist';
}