class ListPlugin
Same name and namespace in other branches
- 10 core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/ListPlugin.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\ListPlugin
- 11.x core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/ListPlugin.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\ListPlugin
CKEditor 5 List plugin.
@internal Plugin classes are internal.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait implements \Drupal\Component\Plugin\PluginBase
- class \Drupal\ckeditor5\Plugin\CKEditor5PluginDefault extends \Drupal\ckeditor5\Plugin\CKEditor5PluginInterface implements \Drupal\Core\Plugin\PluginBase
- class \Drupal\ckeditor5\Plugin\CKEditor5Plugin\ListPlugin extends \Drupal\ckeditor5\Plugin\CKEditor5PluginConfigurableInterface, \Drupal\ckeditor5\Plugin\CKEditor5PluginElementsSubsetInterface uses \Drupal\ckeditor5\Plugin\CKEditor5PluginConfigurableTrait implements \Drupal\ckeditor5\Plugin\CKEditor5PluginDefault
- class \Drupal\ckeditor5\Plugin\CKEditor5PluginDefault extends \Drupal\ckeditor5\Plugin\CKEditor5PluginInterface implements \Drupal\Core\Plugin\PluginBase
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait implements \Drupal\Component\Plugin\PluginBase
Expanded class hierarchy of ListPlugin
1 file declares its use of ListPlugin
- ListPluginTest.php in core/
modules/ ckeditor5/ tests/ src/ Unit/ ListPluginTest.php
1 string reference to 'ListPlugin'
- ckeditor5.ckeditor5.yml in core/
modules/ ckeditor5/ ckeditor5.ckeditor5.yml - core/modules/ckeditor5/ckeditor5.ckeditor5.yml
File
-
core/
modules/ ckeditor5/ src/ Plugin/ CKEditor5Plugin/ ListPlugin.php, line 20
Namespace
Drupal\ckeditor5\Plugin\CKEditor5PluginView source
class ListPlugin extends CKEditor5PluginDefault implements CKEditor5PluginConfigurableInterface, CKEditor5PluginElementsSubsetInterface {
use CKEditor5PluginConfigurableTrait;
/**
* {@inheritdoc}
*/
public function defaultConfiguration() {
return [
'reversed' => TRUE,
'startIndex' => TRUE,
];
}
/**
* {@inheritdoc}
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form['reversed'] = [
'#type' => 'checkbox',
'#title' => $this->t('Allow the user to reverse an ordered list'),
'#default_value' => $this->configuration['reversed'],
];
$form['startIndex'] = [
'#type' => 'checkbox',
'#title' => $this->t('Allow the user to specify the start index of an ordered list'),
'#default_value' => $this->configuration['startIndex'],
];
return $form;
}
/**
* {@inheritdoc}
*/
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
$form_value = $form_state->getValue('reversed');
$form_state->setValue('reversed', (bool) $form_value);
$form_value = $form_state->getValue('startIndex');
$form_state->setValue('startIndex', (bool) $form_value);
}
/**
* {@inheritdoc}
*/
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
$this->configuration['reversed'] = $form_state->getValue('reversed');
$this->configuration['startIndex'] = $form_state->getValue('startIndex');
}
/**
* {@inheritdoc}
*/
public function getDynamicPluginConfig(array $static_plugin_config, EditorInterface $editor) : array {
$static_plugin_config['list']['properties'] = array_merge($static_plugin_config['list']['properties'], $this->getConfiguration());
return $static_plugin_config;
}
/**
* {@inheritdoc}
*/
public function getElementsSubset() : array {
$subset = $this->getPluginDefinition()
->getElements();
$subset = array_diff($subset, [
'<ol reversed start>',
]);
$reversed_enabled = $this->getConfiguration()['reversed'];
$start_index_enabled = $this->getConfiguration()['startIndex'];
$subset[] = "<ol" . ($reversed_enabled ? ' reversed' : '') . ($start_index_enabled ? ' start' : '') . '>';
return $subset;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
CKEditor5PluginConfigurableTrait::getConfiguration | public | function | |||
CKEditor5PluginConfigurableTrait::setConfiguration | public | function | |||
CKEditor5PluginDefault::__construct | public | function | Constructs a \Drupal\Component\Plugin\PluginBase object. | Overrides PluginBase::__construct | 2 |
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 | #[\ReturnTypeWillChange] | 2 | |
ListPlugin::buildConfigurationForm | public | function | Form constructor. | Overrides PluginFormInterface::buildConfigurationForm | |
ListPlugin::defaultConfiguration | public | function | Gets default configuration for this plugin. | Overrides ConfigurableInterface::defaultConfiguration | |
ListPlugin::getDynamicPluginConfig | public | function | Allows a plugin to modify its static configuration. | Overrides CKEditor5PluginDefault::getDynamicPluginConfig | |
ListPlugin::getElementsSubset | public | function | Returns a configured subset of the elements supported by this plugin. | Overrides CKEditor5PluginElementsSubsetInterface::getElementsSubset | |
ListPlugin::submitConfigurationForm | public | function | Form submission handler. | Overrides PluginFormInterface::submitConfigurationForm | |
ListPlugin::validateConfigurationForm | public | function | Form validation handler. | Overrides PluginFormInterface::validateConfigurationForm | |
MessengerTrait::$messenger | protected | property | The messenger. | 27 | |
MessengerTrait::messenger | public | function | Gets the messenger. | 27 | |
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::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 | 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. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.