Skip to content
Snippets Groups Projects
Commit 300cdc45 authored by Rajab Natshah's avatar Rajab Natshah
Browse files

Issue #3277445: Support Drupal 10 and update all use of deprecation in the...

Issue #3277445: Support Drupal 10 and update all use of deprecation in the CKEditor Anchor Link module
parent 0a016a0c
Branches 8.x-1.x
Tags 8.x-1.10
No related merge requests found
...@@ -20,7 +20,8 @@ class AnchorLink extends CKEditorPluginBase { ...@@ -20,7 +20,8 @@ class AnchorLink extends CKEditorPluginBase {
* Implements \Drupal\ckeditor\Plugin\CKEditorPluginInterface::getFile(). * Implements \Drupal\ckeditor\Plugin\CKEditorPluginInterface::getFile().
*/ */
public function getFile() { public function getFile() {
return drupal_get_path('module', 'anchor_link') . '/js/plugins/link/plugin.js'; $anchor_link_path = \Drupal::service('extension.list.module')->getPath('anchor_link');
return $anchor_link_path . '/js/plugins/link/plugin.js';
} }
/** /**
...@@ -50,18 +51,21 @@ class AnchorLink extends CKEditorPluginBase { ...@@ -50,18 +51,21 @@ class AnchorLink extends CKEditorPluginBase {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getButtons() { public function getButtons() {
$anchor_link_path = \Drupal::service('extension.list.module')->getPath('anchor_link');
return [ return [
'LinkToAnchor' => [ 'LinkToAnchor' => [
'label' => $this->t('Link to anchor'), 'label' => $this->t('Link to anchor'),
'image' => drupal_get_path('module', 'anchor_link') . '/js/plugins/link/icons/link.png', 'image' => $anchor_link_path . '/js/plugins/link/icons/link.png',
], ],
'UnlinkAnchor' => [ 'UnlinkAnchor' => [
'label' => $this->t('Unlink Anchor'), 'label' => $this->t('Unlink Anchor'),
'image' => drupal_get_path('module', 'anchor_link') . '/js/plugins/link/icons/unlink.png', 'image' => $anchor_link_path . '/js/plugins/link/icons/unlink.png',
], ],
'Anchor' => [ 'Anchor' => [
'label' => $this->t('Anchor'), 'label' => $this->t('Anchor'),
'image' => drupal_get_path('module', 'anchor_link') . '/js/plugins/link/icons/anchor.png', 'image' => $anchor_link_path . '/js/plugins/link/icons/anchor.png',
], ],
]; ];
} }
......
...@@ -21,7 +21,8 @@ class FakeObjects extends PluginBase implements CKEditorPluginInterface { ...@@ -21,7 +21,8 @@ class FakeObjects extends PluginBase implements CKEditorPluginInterface {
* Implements \Drupal\ckeditor\Plugin\CKEditorPluginInterface::getFile(). * Implements \Drupal\ckeditor\Plugin\CKEditorPluginInterface::getFile().
*/ */
public function getFile() { public function getFile() {
return drupal_get_path('module', 'anchor_link') . '/js/plugins/fakeobjects/plugin.js'; $anchor_link_path = \Drupal::service('extension.list.module')->getPath('anchor_link');
return $anchor_link_path . '/js/plugins/fakeobjects/plugin.js';
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment