class Editor
Same name in this branch
- 9 core/modules/quickedit/src/Plugin/InPlaceEditor/Editor.php \Drupal\quickedit\Plugin\InPlaceEditor\Editor
- 9 core/modules/editor/src/Annotation/Editor.php \Drupal\editor\Annotation\Editor
- 9 core/modules/editor/src/Plugin/InPlaceEditor/Editor.php \Drupal\editor\Plugin\InPlaceEditor\Editor
Same name and namespace in other branches
- 11.x core/modules/editor/src/Attribute/Editor.php \Drupal\editor\Attribute\Editor
- 11.x core/modules/editor/src/Entity/Editor.php \Drupal\editor\Entity\Editor
- 11.x core/modules/editor/src/Annotation/Editor.php \Drupal\editor\Annotation\Editor
- 10 core/modules/editor/src/Attribute/Editor.php \Drupal\editor\Attribute\Editor
- 10 core/modules/editor/src/Entity/Editor.php \Drupal\editor\Entity\Editor
- 10 core/modules/editor/src/Annotation/Editor.php \Drupal\editor\Annotation\Editor
- 8.9.x core/modules/editor/src/Entity/Editor.php \Drupal\editor\Entity\Editor
- 8.9.x core/modules/editor/src/Annotation/Editor.php \Drupal\editor\Annotation\Editor
- 8.9.x core/modules/editor/src/Plugin/InPlaceEditor/Editor.php \Drupal\editor\Plugin\InPlaceEditor\Editor
Defines the configured text editor entity.
Plugin annotation
@ConfigEntityType(
id = "editor",
label = @Translation("Text Editor"),
label_collection = @Translation("Text Editors"),
label_singular = @Translation("text editor"),
label_plural = @Translation("text editors"),
label_count = @PluralTranslation(
singular = "@count text editor",
plural = "@count text editors",
),
handlers = {
"access" = "Drupal\editor\EditorAccessControlHandler",
},
entity_keys = {
"id" = "format"
},
config_export = {
"format",
"editor",
"settings",
"image_upload",
}
)
Hierarchy
- class \Drupal\Core\Entity\EntityBase implements \Drupal\Core\Entity\EntityInterface uses \Drupal\Core\Cache\RefinableCacheableDependencyTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait
- class \Drupal\Core\Config\Entity\ConfigEntityBase implements \Drupal\Core\Config\Entity\ConfigEntityInterface uses \Drupal\Core\Plugin\PluginDependencyTrait, \Drupal\Core\Entity\SynchronizableEntityTrait extends \Drupal\Core\Entity\EntityBase
- class \Drupal\editor\Entity\Editor implements \Drupal\editor\EditorInterface extends \Drupal\Core\Config\Entity\ConfigEntityBase
- class \Drupal\Core\Config\Entity\ConfigEntityBase implements \Drupal\Core\Config\Entity\ConfigEntityInterface uses \Drupal\Core\Plugin\PluginDependencyTrait, \Drupal\Core\Entity\SynchronizableEntityTrait extends \Drupal\Core\Entity\EntityBase
Expanded class hierarchy of Editor
98 files declare their use of Editor
- AddedStylesheetsTest.php in core/
modules/ ckeditor5/ tests/ src/ Functional/ AddedStylesheetsTest.php - AjaxCssTest.php in core/
modules/ ckeditor/ tests/ src/ FunctionalJavascript/ AjaxCssTest.php - BigPipeRegressionTest.php in core/
modules/ ckeditor/ tests/ src/ FunctionalJavascript/ BigPipeRegressionTest.php - ckeditor.api.php in core/
modules/ ckeditor/ ckeditor.api.php - Documentation for CKEditor module APIs.
- ckeditor.module in core/
modules/ ckeditor/ ckeditor.module - Provides integration with the CKEditor WYSIWYG editor.
56 string references to 'Editor'
- CKEditor5::assessActiveTextEditorAfterBuild in core/
modules/ ckeditor5/ src/ Plugin/ Editor/ CKEditor5.php - Form #after_build callback: provides text editor state changes.
- CKEditor5::buildConfigurationForm in core/
modules/ ckeditor5/ src/ Plugin/ Editor/ CKEditor5.php - Form constructor.
- CKEditor5::submitConfigurationForm in core/
modules/ ckeditor5/ src/ Plugin/ Editor/ CKEditor5.php - Form submission handler.
- CKEditor5::validateConfigurationForm in core/
modules/ ckeditor5/ src/ Plugin/ Editor/ CKEditor5.php - Form validation handler.
- CKEditor5ImageController::upload in core/
modules/ ckeditor5/ src/ Controller/ CKEditor5ImageController.php - Uploads and saves an image from a CKEditor 5 POST.
File
-
core/
modules/ editor/ src/ Entity/ Editor.php, line 36
Namespace
Drupal\editor\EntityView source
class Editor extends ConfigEntityBase implements EditorInterface {
/**
* Machine name of the text format for this configured text editor.
*
* @var string
*
* @see getFilterFormat()
*/
protected $format;
/**
* The name (plugin ID) of the text editor.
*
* @var string
*/
protected $editor;
/**
* The structured array of text editor plugin-specific settings.
*
* @var array
*/
protected $settings = [];
/**
* The structured array of image upload settings.
*
* @var array
*/
protected $image_upload = [];
/**
* The filter format this text editor is associated with.
*
* @var \Drupal\filter\FilterFormatInterface
*/
protected $filterFormat;
/**
* @var \Drupal\Component\Plugin\PluginManagerInterface
*/
protected $editorPluginManager;
/**
* {@inheritdoc}
*/
public function id() {
return $this->format;
}
/**
* {@inheritdoc}
*/
public function __construct(array $values, $entity_type) {
parent::__construct($values, $entity_type);
try {
$plugin = $this->editorPluginManager()
->createInstance($this->editor);
$this->settings += $plugin->getDefaultSettings();
} catch (PluginNotFoundException $e) {
// When a Text Editor plugin has gone missing, still allow the Editor
// config entity to be constructed. The only difference is that default
// settings are not added.
}
}
/**
* {@inheritdoc}
*/
public function label() {
return $this->getFilterFormat()
->label();
}
/**
* {@inheritdoc}
*/
public function calculateDependencies() {
parent::calculateDependencies();
// Create a dependency on the associated FilterFormat.
$this->addDependency('config', $this->getFilterFormat()
->getConfigDependencyName());
// @todo use EntityWithPluginCollectionInterface so configuration between
// config entity and dependency on provider is managed automatically.
$definition = $this->editorPluginManager()
->createInstance($this->editor)
->getPluginDefinition();
$this->addDependency('module', $definition['provider']);
return $this;
}
/**
* {@inheritdoc}
*/
public function hasAssociatedFilterFormat() {
return $this->format !== NULL;
}
/**
* {@inheritdoc}
*/
public function getFilterFormat() {
if (!$this->filterFormat) {
$this->filterFormat = \Drupal::entityTypeManager()->getStorage('filter_format')
->load($this->format);
}
return $this->filterFormat;
}
/**
* Returns the editor plugin manager.
*
* @return \Drupal\Component\Plugin\PluginManagerInterface
*/
protected function editorPluginManager() {
if (!$this->editorPluginManager) {
$this->editorPluginManager = \Drupal::service('plugin.manager.editor');
}
return $this->editorPluginManager;
}
/**
* {@inheritdoc}
*/
public function getEditor() {
return $this->editor;
}
/**
* {@inheritdoc}
*/
public function setEditor($editor) {
$this->editor = $editor;
return $this;
}
/**
* {@inheritdoc}
*/
public function getSettings() {
return $this->settings;
}
/**
* {@inheritdoc}
*/
public function setSettings(array $settings) {
$this->settings = $settings;
return $this;
}
/**
* {@inheritdoc}
*/
public function getImageUploadSettings() {
return $this->image_upload;
}
/**
* {@inheritdoc}
*/
public function setImageUploadSettings(array $image_upload_settings) {
$this->image_upload = $image_upload_settings;
return $this;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.