Skip to content
Snippets Groups Projects
Commit 6ef84561 authored by Tyler Struyk's avatar Tyler Struyk Committed by l26yan
Browse files

ISTWCMS-5160: Remove ckeditor.link library in favour for anchor link 3.0.x solution

parent a6f60a01
No related branches found
No related tags found
1 merge request!174ISTWCMS-5160: Remove ckeditor.link library in favour for anchor link 3.0.x solution
<?php
namespace Drupal\uw_cfg_common\Plugin\CKEditorPlugin;
use Drupal\ckeditor\CKEditorPluginBase;
use Drupal\Core\Asset\LibrariesDirectoryFileFinder;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\editor\Entity\Editor;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Defines the "link" plugin.
*
* @CKEditorPlugin(
* id = "link",
* label = @Translation("link")
* )
*/
class LinkPlugin extends CKEditorPluginBase implements ContainerFactoryPluginInterface {
/**
* Library file finder.
*
* @var \Drupal\Core\Asset\LibrariesDirectoryFileFinder
*/
protected $libFileFinder;
/**
* Constructs a BlockComponentRenderArray object.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin ID for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Asset\LibrariesDirectoryFileFinder $libFileFinder
* The library file finder.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, LibrariesDirectoryFileFinder $libFileFinder) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->libFileFinder = $libFileFinder;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container->get('library.libraries_directory_file_finder'));
}
/**
* {@inheritdoc}
*/
public function getDependencies(Editor $editor) {
return [
'fakeobjects',
];
}
/**
* {@inheritdoc}
*/
public function getLibraries(Editor $editor) {
return [];
}
/**
* {@inheritdoc}
*/
public function getConfig(Editor $editor) {
return [];
}
/**
* {@inheritdoc}
*/
public function getButtons() {
$libraryUrl = $this->libFileFinder->find('ckeditor.link');
return [
'Link' => [
'label' => $this->t('Link'),
'image' => $libraryUrl . '/icons/link.png',
],
'Unlink' => [
'label' => $this->t('Unlink'),
'image' => $libraryUrl . '/icons/unlink.png',
],
'Anchor' => [
'label' => $this->t('Anchor'),
'image' => $libraryUrl . '/icons/anchor.png',
],
];
}
/**
* {@inheritdoc}
*/
public function getFile() {
return $this->libFileFinder->find('ckeditor.link') . '/plugin.js';
}
/**
* {@inheritdoc}
*/
public function isInternal() {
return FALSE;
}
}
...@@ -4,6 +4,7 @@ type: module ...@@ -4,6 +4,7 @@ type: module
core_version_requirement: '^8.9 || ^9' core_version_requirement: '^8.9 || ^9'
dependencies: dependencies:
- 'composer_deploy:composer_deploy' - 'composer_deploy:composer_deploy'
- 'drupal:anchor_link'
- 'drupal:better_exposed_filters' - 'drupal:better_exposed_filters'
- 'drupal:block_content' - 'drupal:block_content'
- 'drupal:block_list_override' - 'drupal:block_list_override'
......
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