ModerationInformationInterface
interface ModerationInformationInterface (View source)
Interface for moderation_information service.
Methods
Determines if an entity type can have moderated entities.
Determines if an entity type/bundle entities should be moderated.
Determines if an entity type has at least one moderated bundle.
Returns the revision ID of the default revision for the specified entity.
Returns the revision translation affected translation of a revision.
Determines if a pending revision exists for the specified entity.
Determines if the default revision for the given entity is published.
Gets the workflow for the given content entity.
Gets the workflow for the given entity type and bundle.
Gets unsupported features for a given entity type.
Gets the original or initial state of the given entity.
Details
bool
isModeratedEntity(EntityInterface $entity)
Determines if an entity is moderated.
bool
canModerateEntitiesOfEntityType(EntityTypeInterface $entity_type)
Determines if an entity type can have moderated entities.
bool
shouldModerateEntitiesOfBundle(EntityTypeInterface $entity_type, string $bundle)
Determines if an entity type/bundle entities should be moderated.
bool
isModeratedEntityType(EntityTypeInterface $entity_type)
Determines if an entity type has at least one moderated bundle.
int
getDefaultRevisionId(string $entity_type_id, int $entity_id)
Returns the revision ID of the default revision for the specified entity.
ContentEntityInterface
getAffectedRevisionTranslation(ContentEntityInterface $entity)
Returns the revision translation affected translation of a revision.
bool
hasPendingRevision(ContentEntityInterface $entity)
Determines if a pending revision exists for the specified entity.
bool
isLiveRevision(ContentEntityInterface $entity)
Determines if an entity is "live".
A "live" entity revision is one whose latest revision is also the default, and whose moderation state, if any, is a published state.
bool
isDefaultRevisionPublished(ContentEntityInterface $entity)
Determines if the default revision for the given entity is published.
The default revision is the same as the entity retrieved by "default" from the storage handler. If the entity is translated, check if any of the translations are published.
WorkflowInterface|null
getWorkflowForEntity(ContentEntityInterface $entity)
Gets the workflow for the given content entity.
WorkflowInterface|null
getWorkflowForEntityTypeAndBundle(string $entity_type_id, string $bundle_id)
Gets the workflow for the given entity type and bundle.
array
getUnsupportedFeatures(EntityTypeInterface $entity_type)
Gets unsupported features for a given entity type.
ContentModerationState
getOriginalState(ContentEntityInterface $entity)
Gets the original or initial state of the given entity.
When a state is being validated, the original state is used to validate that a valid transition exists for target state and the user has access to the transition between those two states. If the entity has been moderated before, we can load the original unmodified revision and translation for this state.
If the entity is new we need to load the initial state from the workflow. Even if a value was assigned to the moderation_state field, the initial state is used to compute an appropriate transition for the purposes of validation.