3 namespace Drupal\content_moderation\Entity\Handler;
5 use Drupal\Core\Entity\ContentEntityInterface;
6 use Drupal\Core\Form\FormStateInterface;
9 * Defines operations that need to vary by entity type.
11 * Much of the logic contained in this handler is an indication of flaws
12 * in the Entity API that are insufficiently standardized between entity types.
13 * Hopefully over time functionality can be removed from this interface.
15 interface ModerationHandlerInterface {
18 * Operates on moderated content entities preSave().
20 * @param \Drupal\Core\Entity\ContentEntityInterface $entity
21 * The entity to modify.
22 * @param bool $default_revision
23 * Whether the new revision should be made the default revision.
24 * @param bool $published_state
25 * Whether the state being transitioned to is a published state or not.
27 public function onPresave(ContentEntityInterface $entity, $default_revision, $published_state);
30 * Alters entity forms to enforce revision handling.
33 * An associative array containing the structure of the form.
34 * @param \Drupal\Core\Form\FormStateInterface $form_state
35 * The current state of the form.
36 * @param string $form_id
39 * @see hook_form_alter()
41 public function enforceRevisionsEntityFormAlter(array &$form, FormStateInterface $form_state, $form_id);
44 * Alters bundle forms to enforce revision handling.
47 * An associative array containing the structure of the form.
48 * @param \Drupal\Core\Form\FormStateInterface $form_state
49 * The current state of the form.
50 * @param string $form_id
53 * @see hook_form_alter()
55 public function enforceRevisionsBundleFormAlter(array &$form, FormStateInterface $form_state, $form_id);