class EntityLinkSuggestions
CKEditor 5 Entity Link Suggestions plugin.
@internal Plugin classes are internal.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\DependencyInjection\AutowiredInstanceTrait, \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait extends \Drupal\Component\Plugin\PluginBase
- class \Drupal\ckeditor5\Plugin\CKEditor5PluginDefault implements \Drupal\ckeditor5\Plugin\CKEditor5PluginInterface extends \Drupal\Core\Plugin\PluginBase
- class \Drupal\ckeditor5\Plugin\CKEditor5Plugin\EntityLinkSuggestions implements \Drupal\ckeditor5\Plugin\CKEditor5PluginConfigurableInterface, \Drupal\Core\Plugin\ContainerFactoryPluginInterface uses \Drupal\ckeditor5\Plugin\CKEditor5PluginConfigurableTrait, \Drupal\ckeditor5\Plugin\CKEditor5Plugin\DynamicPluginConfigWithCsrfTokenUrlTrait extends \Drupal\ckeditor5\Plugin\CKEditor5PluginDefault
- class \Drupal\ckeditor5\Plugin\CKEditor5PluginDefault implements \Drupal\ckeditor5\Plugin\CKEditor5PluginInterface extends \Drupal\Core\Plugin\PluginBase
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\DependencyInjection\AutowiredInstanceTrait, \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait extends \Drupal\Component\Plugin\PluginBase
Expanded class hierarchy of EntityLinkSuggestions
1 string reference to 'EntityLinkSuggestions'
- ckeditor5.ckeditor5.yml in core/
modules/ ckeditor5/ ckeditor5.ckeditor5.yml - core/modules/ckeditor5/ckeditor5.ckeditor5.yml
File
-
core/
modules/ ckeditor5/ src/ Plugin/ CKEditor5Plugin/ EntityLinkSuggestions.php, line 23
Namespace
Drupal\ckeditor5\Plugin\CKEditor5PluginView source
class EntityLinkSuggestions extends CKEditor5PluginDefault implements CKEditor5PluginConfigurableInterface, ContainerFactoryPluginInterface {
use CKEditor5PluginConfigurableTrait;
use DynamicPluginConfigWithCsrfTokenUrlTrait;
/**
* EntityLinkSuggestions constructor.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, protected readonly EntityTypeManagerInterface $entityTypeManager, protected readonly EntityTypeBundleInfoInterface $entityTypeBundleInfo) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
}
/**
* {@inheritdoc}
*/
public function getDynamicPluginConfig(array $static_plugin_config, EditorInterface $editor) : array {
$dynamic_plugin_config = $static_plugin_config;
$dynamic_plugin_config['drupalEntityLinkSuggestions']['suggestionsUrl'] = self::getUrlWithReplacedCsrfTokenPlaceholder(Url::fromRoute('ckeditor5.entity_link_suggestions')->setRouteParameter('editor', $editor->id()));
return $dynamic_plugin_config;
}
/**
* {@inheritdoc}
*/
public function defaultConfiguration() : array {
return [];
}
/**
* {@inheritdoc}
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state) : array {
$allowed_bundles = [];
$all_bundle_info = $this->entityTypeBundleInfo
->getAllBundleInfo();
foreach ($all_bundle_info as $entity_type => $bundles) {
foreach ($bundles as $key => $bundle) {
if (!empty($bundle['ckeditor5_link_suggestions'])) {
$allowed_bundles[$entity_type][$key] = $key;
}
}
}
$header = [
'enabled' => $this->t('Supported entity types'),
'bundles' => $this->t('Bundles'),
];
$form['entity_types'] = [
'#type' => 'table',
'#header' => $header,
'#title' => $this->t('Allowed entity types'),
];
$entity_types = $this->entityTypeManager
->getDefinitions();
foreach ($allowed_bundles as $entity_type_id => $bundles) {
$entity_type = $entity_types[$entity_type_id];
$bundles_for_entity_type = $this->entityTypeBundleInfo
->getBundleInfo($entity_type_id);
$bundles_list = [];
foreach ($bundles as $bundle) {
$bundles_list[] = $bundles_for_entity_type[$bundle]['label'];
}
$row = [
'enabled' => [
'#markup' => $entity_type->getCollectionLabel(),
],
'bundles' => [
[
'#markup' => $this->t('Included %bundles', [
'%bundles' => $this->entityTypeManager
->getDefinition($entity_type->getBundleEntityType())
->getPluralLabel(),
]),
],
[
'#theme' => 'item_list',
'#items' => $bundles_list,
'#list_type' => 'ol',
],
],
];
$form['entity_types'][$entity_type_id] = $row;
}
return $form;
}
/**
* {@inheritdoc}
*/
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) : void {
}
/**
* {@inheritdoc}
*/
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) : void {
}
}
Members
| Title Sort descending | Deprecated | Modifiers | Object type | Summary | Overriden Title | Overrides |
|---|---|---|---|---|---|---|
| AutowiredInstanceTrait::createInstanceAutowired | public static | function | Instantiates a new instance of the implementing class using autowiring. | |||
| CKEditor5PluginConfigurableTrait::getConfiguration | public | function | ||||
| CKEditor5PluginConfigurableTrait::setConfiguration | public | function | ||||
| DependencySerializationTrait::$_entityStorages | protected | property | An array of entity type IDs keyed by the property name of their storages. | |||
| DependencySerializationTrait::$_serviceIds | protected | property | An array of service IDs keyed by property name used for serialization. | |||
| DependencySerializationTrait::__sleep | public | function | 2 | |||
| DependencySerializationTrait::__wakeup | public | function | 2 | |||
| DynamicPluginConfigWithCsrfTokenUrlTrait::getUrlWithReplacedCsrfTokenPlaceholder | private static | function | Gets the given URL with all placeholders replaced. | |||
| EntityLinkSuggestions::buildConfigurationForm | public | function | Form constructor. | Overrides PluginFormInterface::buildConfigurationForm | ||
| EntityLinkSuggestions::defaultConfiguration | public | function | Gets default configuration for this plugin. | Overrides ConfigurableInterface::defaultConfiguration | ||
| EntityLinkSuggestions::getDynamicPluginConfig | public | function | Allows a plugin to modify its static configuration. | Overrides CKEditor5PluginDefault::getDynamicPluginConfig | ||
| EntityLinkSuggestions::submitConfigurationForm | public | function | Form submission handler. | Overrides PluginFormInterface::submitConfigurationForm | ||
| EntityLinkSuggestions::validateConfigurationForm | public | function | Form validation handler. | Overrides PluginFormInterface::validateConfigurationForm | ||
| EntityLinkSuggestions::__construct | public | function | EntityLinkSuggestions constructor. | Overrides CKEditor5PluginDefault::__construct | ||
| MessengerTrait::$messenger | protected | property | The messenger. | 25 | ||
| MessengerTrait::messenger | public | function | Gets the messenger. | 25 | ||
| MessengerTrait::setMessenger | public | function | Sets the messenger. | |||
| PluginBase::$configuration | protected | property | Configuration information passed into the plugin. | 1 | ||
| PluginBase::$pluginDefinition | protected | property | The plugin implementation definition. | 1 | ||
| PluginBase::$pluginId | protected | property | The plugin ID. | |||
| PluginBase::create | public static | function | Instantiates a new instance of the implementing class using autowiring. | 165 | ||
| PluginBase::DERIVATIVE_SEPARATOR | constant | A string which is used to separate base plugin IDs from the derivative ID. | ||||
| PluginBase::getBaseId | public | function | Gets the base_plugin_id of the plugin instance. | Overrides DerivativeInspectionInterface::getBaseId | ||
| PluginBase::getDerivativeId | public | function | Gets the derivative_id of the plugin instance. | Overrides DerivativeInspectionInterface::getDerivativeId | ||
| PluginBase::getPluginDefinition | public | function | Gets the definition of the plugin implementation. | Overrides PluginInspectionInterface::getPluginDefinition | 2 | |
| PluginBase::getPluginId | public | function | Gets the plugin ID of the plugin instance. | Overrides PluginInspectionInterface::getPluginId | ||
| PluginBase::isConfigurable | Deprecated | public | function | Determines if the plugin is configurable. | ||
| StringTranslationTrait::$stringTranslation | protected | property | The string translation service. | 3 | ||
| StringTranslationTrait::formatPlural | protected | function | Formats a string containing a count of items. | |||
| StringTranslationTrait::getNumberOfPlurals | protected | function | Returns the number of plurals supported by a given language. | |||
| StringTranslationTrait::getStringTranslation | protected | function | Gets the string translation service. | |||
| StringTranslationTrait::setStringTranslation | public | function | Sets the string translation service to use. | 2 | ||
| StringTranslationTrait::t | protected | function | Translates a string to the current language or to a given language. | 1 |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.