public function FontCKEditorButton::getLibraryPath in CKEditor Font Size and Family 8
Get library path.
1 call to FontCKEditorButton::getLibraryPath()
- FontCKEditorButton::getFile in src/
Plugin/ CKEditorPlugin/ FontCKEditorButton.php - Returns the Drupal root-relative file path to the plugin JavaScript file.
File
- src/
Plugin/ CKEditorPlugin/ FontCKEditorButton.php, line 50
Class
- FontCKEditorButton
- Defines the "font" plugin.
Namespace
Drupal\ckeditor_font\Plugin\CKEditorPluginCode
public function getLibraryPath() {
// See https://www.drupal.org/project/ckeditor_font/issues/3046772 for
// considerations on $plugin_path moving forward, from ambiguity in 'font'.
// Following the logic in Drupal 8.9.x and Drupal 9.x
// ----------------------------------------------------------------------
// Issue #3096648: Add support for third party libraries in site specific
// and install profile specific libraries folders
// https://www.drupal.org/project/drupal/issues/3096648
//
// https://git.drupalcode.org/project/drupal/commit/1edf15f
// -----------------------------------------------------------------------
// Search sites/<domain>/*.
$directories[] = \Drupal::service('site.path') . "/libraries/";
// Always search the root 'libraries' directory.
$directories[] = 'libraries/';
// Installation profiles can place libraries into a 'libraries' directory.
if ($installProfile = \Drupal::installProfile()) {
$profile_path = drupal_get_path('profile', $installProfile);
$directories[] = "{$profile_path}/libraries/";
}
foreach ($directories as $dir) {
if (file_exists(DRUPAL_ROOT . '/' . $dir . 'font/plugin.js')) {
return $dir . 'font';
}
}
return FALSE;
}