public function StaticDetector::detectVersion in Libraries API 8.3
Detects the version of a library.
@todo Provide a mechanism for version detectors to provide a reason for failing.
Parameters
\Drupal\libraries\ExternalLibrary\Version\VersionedLibraryInterface $library: The library whose version to detect.
Throws
\Drupal\libraries\ExternalLibrary\Exception\UnknownLibraryVersionException
Overrides VersionDetectorInterface::detectVersion
File
- src/
Plugin/ libraries/ VersionDetector/ StaticDetector.php, line 39
Class
- StaticDetector
- Detects the version by returning a static string.
Namespace
Drupal\libraries\Plugin\libraries\VersionDetectorCode
public function detectVersion(VersionedLibraryInterface $library) {
if (!isset($this->configuration['version'])) {
throw new UnknownLibraryVersionException($library);
}
$library
->setVersion($this->configuration['version']);
}