You are here

protected function WebformLibrariesManager::getCkeditorVersion in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/WebformLibrariesManager.php \Drupal\webform\WebformLibrariesManager::getCkeditorVersion()

Get Drupal core's CKEditor version number.

Return value

string Drupal core's CKEditor version number.

1 call to WebformLibrariesManager::getCkeditorVersion()
WebformLibrariesManager::initLibraries in src/WebformLibrariesManager.php
Initialize libraries.

File

src/WebformLibrariesManager.php, line 547

Class

WebformLibrariesManager
Webform libraries manager.

Namespace

Drupal\webform

Code

protected function getCkeditorVersion() {

  // Get CKEditor semantic version number from the JS file.
  // @see core/core.libraries.yml
  $definition = $this->libraryDiscovery
    ->getLibraryByName('core', 'ckeditor');
  $ckeditor_version = $definition['js'][0]['version'];

  // Parse CKEditor semantic version number from security patches
  // (i.e. 4.8.0+2018-04-18-security-patch).
  if (preg_match('/^\\d+\\.\\d+\\.\\d+/', $ckeditor_version, $match)) {
    return $match[0];
  }
  else {
    return $ckeditor_version;
  }
}