protected static function AssetManager::parseForCoreCKEditorVersion in CKEditor Media Embed Plugin 8
1 call to AssetManager::parseForCoreCKEditorVersion()
File
- src/
AssetManager.php, line 191
Class
- AssetManager
- The AssetManager facade for managing CKEditor plugins.
Namespace
Drupal\ckeditor_media_embedCode
protected static function parseForCoreCKEditorVersion($path, $extension) {
$version = '';
$libraries = [];
$library_file = \Drupal::root() . '/' . $path . '/' . $extension . '.libraries.yml';
if (file_exists($library_file)) {
try {
$libraries = Yaml::decode(file_get_contents($library_file));
if (!empty($libraries['ckeditor']['version'])) {
$version = $libraries['ckeditor']['version'];
$version_extra_position = strpos($libraries['ckeditor']['version'], '+');
if ($version_extra_position > 0) {
$version = substr($version, 0, $version_extra_position);
}
}
} catch (InvalidDataTypeException $e) {
// Rethrow a more helpful exception to provide context.
throw new InvalidLibraryFileException(sprintf('Invalid library definition in %s: %s', $library_file, $e
->getMessage()), 0, $e);
}
}
return $version;
}