trait LayoutEntityHelperTrait (View source)

Methods to help with entities using the layout builder.

Properties

protected SectionStorageManagerInterface $sectionStorageManager

The section storage manager.

Methods

bool
isLayoutCompatibleEntity(EntityInterface $entity)

Determines if an entity can have a layout.

int[]
getInlineBlockRevisionIdsInSections(array $sections)

Gets revision IDs for layout sections.

getEntitySections(EntityInterface $entity)

Gets the sections for an entity if any.

getInlineBlockComponents(array $sections)

Gets components that have Inline Block plugins.

getSectionStorageForEntity(EntityInterface $entity)

Gets the section storage for an entity.

bool
originalEntityUsesDefaultStorage(EntityInterface $entity)

Determines if the original entity used the default section storage.

Details

protected bool isLayoutCompatibleEntity(EntityInterface $entity)

Determines if an entity can have a layout.

Parameters

EntityInterface $entity

The entity to check.

Return Value

bool

TRUE if the entity can have a layout otherwise FALSE.

protected int[] getInlineBlockRevisionIdsInSections(array $sections)

Gets revision IDs for layout sections.

Parameters

array $sections

The layout sections.

Return Value

int[]

The revision IDs.

protected Section[] getEntitySections(EntityInterface $entity)

Gets the sections for an entity if any.

Parameters

EntityInterface $entity

The entity.

Return Value

Section[]

The entity layout sections if available.

protected SectionComponent[] getInlineBlockComponents(array $sections)

Gets components that have Inline Block plugins.

Parameters

array $sections

The layout sections.

Return Value

SectionComponent[]

The components that contain Inline Block plugins.

protected SectionStorageInterface|null getSectionStorageForEntity(EntityInterface $entity)

Gets the section storage for an entity.

Parameters

EntityInterface $entity

The entity.

Return Value

SectionStorageInterface|null

The section storage if found otherwise NULL.

protected bool originalEntityUsesDefaultStorage(EntityInterface $entity)

Determines if the original entity used the default section storage.

This method can be used during the entity save process to determine whether $entity->original is set and used the default section storage plugin as determined by ::getSectionStorageForEntity().

Parameters

EntityInterface $entity

The entity.

Return Value

bool

TRUE if the original entity used the default storage.