class EditorSelector implements EditorSelectorInterface (View source)

Selects an in-place editor (an InPlaceEditor plugin) for a field.

Properties

protected PluginManagerInterface $editorManager

The manager for editor plugins.

protected FormatterPluginManager $formatterManager

The manager for formatter plugins.

protected array $alternatives

A list of alternative editor plugin IDs, keyed by editor plugin ID.

Methods

__construct(PluginManagerInterface $editor_manager, FormatterPluginManager $formatter_manager)

Constructs a new EditorSelector.

string|null
getEditor(string $formatter_type, FieldItemListInterface $items)

Returns the in-place editor (an InPlaceEditor plugin) to use for a field.

array
getEditorAttachments(array $editor_ids)

Returns the attachments for all editors.

Details

__construct(PluginManagerInterface $editor_manager, FormatterPluginManager $formatter_manager)

Constructs a new EditorSelector.

Parameters

PluginManagerInterface $editor_manager

The manager for editor plugins.

FormatterPluginManager $formatter_manager

The manager for formatter plugins.

string|null getEditor(string $formatter_type, FieldItemListInterface $items)

Returns the in-place editor (an InPlaceEditor plugin) to use for a field.

Parameters

string $formatter_type

The field's formatter type name.

FieldItemListInterface $items

The field values to be in-place edited.

Return Value

string|null

The editor to use, or NULL to not enable in-place editing.

array getEditorAttachments(array $editor_ids)

Returns the attachments for all editors.

Parameters

array $editor_ids

A list of all in-place editor IDs that should be attached.

Return Value

array

An array of attachments, for use with #attached.