class QuickEditIntegration implements ContainerInjectionInterface (View source)

internal  This is an internal utility class wrapping hook implementations.
 

Helper methods for Quick Edit module integration.

Traits

Wrapper methods for the logger factory service.

Properties

protected LoggerChannelFactoryInterface $loggerFactory

The logger channel factory service.

from  LoggerChannelTrait
protected SectionStorageManagerInterface $sectionStorageManager

The section storage manager.

protected AccountInterface $currentUser

The current user.

protected EntityTypeManagerInterface $entityTypeManager

The entity type manager.

Methods

LoggerInterface
getLogger(string $channel)

Gets the logger for a specific channel.

$this
setLoggerFactory(LoggerChannelFactoryInterface $logger_factory)

Injects the logger channel factory.

__construct(SectionStorageManagerInterface $section_storage_manager, AccountInterface $current_user, EntityTypeManagerInterface $entity_type_manager)

Constructs a new QuickEditIntegration object.

static 
create(ContainerInterface $container)

Instantiates a new instance of this class.

entityViewAlter(array $build, EntityInterface $entity, EntityViewDisplayInterface $display)

Alters the entity view build for Quick Edit compatibility.

static array
deconstructViewModeId(string $quick_edit_view_mode_id)

Deconstructs the Quick Edit view mode ID into its constituent parts.

array
quickEditRenderField(FieldableEntityInterface $entity, string $field_name, string $quick_edit_view_mode_id, string $langcode)

Re-renders a field rendered by Layout Builder, edited with Quick Edit.

Details

protected LoggerInterface getLogger(string $channel)

Gets the logger for a specific channel.

Require the use of injected services: https://www.drupal.org/node/2733703

Parameters

string $channel

The name of the channel. Can be any string, but the general practice is to use the name of the subsystem calling this.

Return Value

LoggerInterface

The logger for the given channel.

$this setLoggerFactory(LoggerChannelFactoryInterface $logger_factory)

Injects the logger channel factory.

Parameters

LoggerChannelFactoryInterface $logger_factory

The logger channel factory service.

Return Value

$this

__construct(SectionStorageManagerInterface $section_storage_manager, AccountInterface $current_user, EntityTypeManagerInterface $entity_type_manager)

Constructs a new QuickEditIntegration object.

Parameters

SectionStorageManagerInterface $section_storage_manager

The section storage manager.

AccountInterface $current_user

The current user.

EntityTypeManagerInterface $entity_type_manager

The entity type manager.

static create(ContainerInterface $container)

Instantiates a new instance of this class.

This is a factory method that returns a new instance of this class. The factory should pass any needed dependencies into the constructor of this class, but not the container itself. Every call to this method must return a new instance of this class; that is, it may not implement a singleton.

Parameters

ContainerInterface $container

The service container this instance should use.

entityViewAlter(array $build, EntityInterface $entity, EntityViewDisplayInterface $display)

Alters the entity view build for Quick Edit compatibility.

When rendering fields outside of normal view modes, Quick Edit requires that modules identify themselves with a view mode ID in the format [module_name]-[information the module needs to rerender], as prescribed by hook_quickedit_render_field().

Parameters

array $build

The built entity render array.

EntityInterface $entity

The entity.

EntityViewDisplayInterface $display

The entity view display.

See also

hook_quickedit_render_field()
layout_builder_quickedit_render_field()

static array deconstructViewModeId(string $quick_edit_view_mode_id)

Deconstructs the Quick Edit view mode ID into its constituent parts.

Parameters

string $quick_edit_view_mode_id

The Quick Edit view mode ID.

Return Value

array

An array containing the entity view mode ID, the delta, the component UUID, and the entity ID.

See also

\Drupal\layout_builder\QuickEditIntegration::getViewModeId()

array quickEditRenderField(FieldableEntityInterface $entity, string $field_name, string $quick_edit_view_mode_id, string $langcode)

Re-renders a field rendered by Layout Builder, edited with Quick Edit.

Parameters

FieldableEntityInterface $entity

The entity.

string $field_name

The field name.

string $quick_edit_view_mode_id

The Quick Edit view mode ID.

string $langcode

The language code.

Return Value

array

The re-rendered field.