protected function AnchorLink::getLibraryPath in CKEditor Anchor Link - For Drupal 8 and 9 8.2
Get the CKEditor Link library path.
1 call to AnchorLink::getLibraryPath()
- AnchorLink::getFile in src/
Plugin/ CKEditorPlugin/ AnchorLink.php - Returns the Drupal root-relative file path to the plugin JavaScript file.
File
- src/
Plugin/ CKEditorPlugin/ AnchorLink.php, line 81
Class
- AnchorLink
- Defines the "link" plugin.
Namespace
Drupal\anchor_link\Plugin\CKEditorPluginCode
protected function getLibraryPath() {
// 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 . 'link/plugin.js')) {
return $dir . 'link';
}
}
return 'libraries/link';
}