ModerationHandlerInterface
interface ModerationHandlerInterface (View source)
| internal |
Defines operations that need to vary by entity type.
Much of the logic contained in this handler is an indication of flaws in the Entity API that are insufficiently standardized between entity types. Hopefully over time functionality can be removed from this interface.
Methods
Operates on moderated content entities preSave().
Alters entity forms to enforce revision handling.
Alters bundle forms to enforce revision handling.
Details
bool
isModeratedEntity(ContentEntityInterface $entity)
Determines if an entity should be moderated.
At the workflow level, moderation is enabled or disabled for entire entity types or bundles. After a bundle has been enabled, there maybe be further decisions each entity type may make to evaluate if a given entity is appropriate to be included in a moderation workflow. The handler is only consulted after the user has configured the associated entity type and bundle to be included in a moderation workflow.
Returning FALSE will remove the moderation state field widget from the associated entity form and opt out of all moderation related entity semantics, such as creating new revisions and changing the publishing status of a revision.
onPresave(ContentEntityInterface $entity, bool $default_revision, bool $published_state)
Operates on moderated content entities preSave().
enforceRevisionsEntityFormAlter(array $form, FormStateInterface $form_state, string $form_id)
Alters entity forms to enforce revision handling.
enforceRevisionsBundleFormAlter(array $form, FormStateInterface $form_state, string $form_id)
Alters bundle forms to enforce revision handling.