You are here

public function ColorButton::getLibraryPath in CKEditor Color Button 8

Get path to library folder.

2 calls to ColorButton::getLibraryPath()
ColorButton::getButtons in src/Plugin/CKEditorPlugin/ColorButton.php
Returns the buttons that this plugin provides, along with metadata.
ColorButton::getFile in src/Plugin/CKEditorPlugin/ColorButton.php
Returns the Drupal root-relative file path to the plugin JavaScript file.

File

src/Plugin/CKEditorPlugin/ColorButton.php, line 23

Class

ColorButton
Defines the "colorbutton" plugin.

Namespace

Drupal\colorbutton\Plugin\CKEditorPlugin

Code

public function getLibraryPath() {

  // @todo Remove backward compatibility conditions when we bump Drupal
  //   requirement to 8.9.0. See https://www.drupal.org/node/3099614
  if (\Drupal::hasService('library.libraries_directory_file_finder')) {

    /** @var \Drupal\Core\Asset\LibrariesDirectoryFileFinder $library_file_finder */
    $path = \Drupal::service('library.libraries_directory_file_finder')
      ->find('colorbutton');
  }
  elseif (\Drupal::moduleHandler()
    ->moduleExists('libraries')) {
    $path = libraries_get_path('colorbutton');
  }
  else {
    $path = 'libraries/colorbutton';
  }
  return $path;
}