InlineBlockEntityOperations
class InlineBlockEntityOperations implements ContainerInjectionInterface (View source)
| internal | This is an internal utility class wrapping hook implementations. |
Defines a class for reacting to entity events related to Inline Blocks.
Traits
Methods to help with entities using the layout builder.
Properties
| protected SectionStorageManagerInterface | $sectionStorageManager | The section storage manager. |
from LayoutEntityHelperTrait |
| protected InlineBlockUsageInterface | $usage | Inline block usage tracking service. |
|
| protected EntityStorageInterface | $blockContentStorage | The block content storage. |
|
| protected EntityTypeManagerInterface | $entityTypeManager | The entity type manager. |
Methods
Gets revision IDs for layout sections.
Gets components that have Inline Block plugins.
Determines if an entity is using a field for the layout override.
Determines if the original entity used the default section storage.
Constructs a new EntityOperations object.
Instantiates a new instance of this class.
Delete the inline blocks and the usage records.
Removes unused inline blocks.
Gets blocks IDs for an array of revision IDs.
Saves an inline block component.
Details
protected bool
isLayoutCompatibleEntity(EntityInterface $entity)
Determines if an entity can have a layout.
protected int[]
getInlineBlockRevisionIdsInSections(array $sections)
Gets revision IDs for layout sections.
protected Section[]
getEntitySections(EntityInterface $entity)
Gets the sections for an entity if any.
protected SectionComponent[]
getInlineBlockComponents(array $sections)
Gets components that have Inline Block plugins.
protected SectionStorageInterface|null
getSectionStorageForEntity(EntityInterface $entity)
Gets the section storage for an entity.
protected bool
isEntityUsingFieldOverride(EntityInterface $entity)
deprecated
deprecated
Determines if an entity is using a field for the layout override.
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().
__construct(EntityTypeManagerInterface $entityTypeManager, InlineBlockUsageInterface $usage, Connection $database, SectionStorageManagerInterface $section_storage_manager = NULL)
Constructs a new EntityOperations object.
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.
protected
removeUnusedForEntityOnSave(EntityInterface $entity)
Remove all unused inline blocks on save.
Entities that were used in prevision revisions will be removed if not saving a new revision.
protected int[]
getRemovedBlockIds(EntityInterface $entity)
Gets the IDs of the inline blocks that were removed.
handleEntityDelete(EntityInterface $entity)
Handles entity tracking on deleting a parent entity.
handlePreSave(EntityInterface $entity)
Handles saving a parent entity.
protected int
getPluginBlockId(InlineBlock $block_plugin)
Gets a block ID for an inline block plugin.
protected
deleteBlocksAndUsage(array $block_content_ids)
Delete the inline blocks and the usage records.
removeUnused(int $limit = 100)
Removes unused inline blocks.
protected int[]
getBlockIdsForRevisionIds(array $revision_ids)
Gets blocks IDs for an array of revision IDs.
protected
saveInlineBlockComponent(EntityInterface $entity, SectionComponent $component, bool $new_revision, bool $duplicate_blocks)
Saves an inline block component.