class MetadataGenerator implements MetadataGeneratorInterface (View source)

Generates in-place editing metadata for an entity field.

Properties

protected QuickEditEntityFieldAccessCheckInterface $accessChecker

An object that checks if a user has access to edit a given entity field.

protected EditorSelectorInterface $editorSelector

An object that determines which editor to attach to a given field.

protected PluginManagerInterface $editorManager

The manager for editor plugins.

Methods

__construct(QuickEditEntityFieldAccessCheckInterface $access_checker, EditorSelectorInterface $editor_selector, PluginManagerInterface $editor_manager)

Constructs a new MetadataGenerator.

array
generateEntityMetadata(EntityInterface $entity)

Generates in-place editing metadata for an entity.

array
generateFieldMetadata(FieldItemListInterface $items, string $view_mode)

Generates in-place editing metadata for an entity field.

Details

__construct(QuickEditEntityFieldAccessCheckInterface $access_checker, EditorSelectorInterface $editor_selector, PluginManagerInterface $editor_manager)

Constructs a new MetadataGenerator.

Parameters

QuickEditEntityFieldAccessCheckInterface $access_checker

An object that checks if a user has access to edit a given field.

EditorSelectorInterface $editor_selector

An object that determines which editor to attach to a given field.

PluginManagerInterface $editor_manager

The manager for editor plugins.

array generateEntityMetadata(EntityInterface $entity)

Generates in-place editing metadata for an entity.

Parameters

EntityInterface $entity

The entity, in the language in which one of its fields is being edited.

Return Value

array

An array containing metadata with the following keys:

  • label: the user-visible label for the entity in the given language.

array generateFieldMetadata(FieldItemListInterface $items, string $view_mode)

Generates in-place editing metadata for an entity field.

Parameters

FieldItemListInterface $items

The field values to be in-place edited.

string $view_mode

The view mode the field should be rerendered in.

Return Value

array

An array containing metadata with the following keys:

  • label: the user-visible label for the field.
  • access: whether the current user may edit the field or not.
  • editor: which editor should be used for the field.
  • aria: the ARIA label.
  • custom: (optional) any additional metadata that the editor provides.