EntityOperations
class EntityOperations implements ContainerInjectionInterface (View source)
| internal |
Defines a class for reacting to entity events.
Properties
| protected ModerationInformationInterface | $moderationInfo | The Moderation Information service. |
|
| protected EntityTypeManagerInterface | $entityTypeManager | The Entity Type Manager service. |
|
| protected FormBuilderInterface | $formBuilder | The Form Builder service. |
|
| protected EntityTypeBundleInfoInterface | $bundleInfo | The entity bundle information service. |
|
| protected RouteBuilderInterface | $routerBuilder | The router builder service. |
Methods
Constructs a new EntityOperations object.
Instantiates a new instance of this class.
Acts on an entity and set published status based on the moderation state.
Creates or updates the moderation state of an entity.
Act on entities being assembled before rendering.
Details
__construct(ModerationInformationInterface $moderation_info, EntityTypeManagerInterface $entity_type_manager, FormBuilderInterface $form_builder, EntityTypeBundleInfoInterface $bundle_info, RouteBuilderInterface $router_builder)
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.
entityPresave(EntityInterface $entity)
Acts on an entity and set published status based on the moderation state.
entityInsert(EntityInterface $entity)
No description
entityUpdate(EntityInterface $entity)
No description
protected
updateOrCreateFromEntity(EntityInterface $entity)
Creates or updates the moderation state of an entity.
entityDelete(EntityInterface $entity)
No description
entityRevisionDelete(EntityInterface $entity)
No description
entityTranslationDelete(EntityInterface $translation)
No description
entityView(array $build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode)
Act on entities being assembled before rendering.
protected bool
isPublished(ContentEntityInterface $entity)
Checks if the entity is published.
This method is optimized to not have to unnecessarily load the moderation state and workflow if it is not required.