976fbb29da218aa5e0776e06aa3f4a04fec36ee7
[yaffs-website] / web / core / modules / content_moderation / src / Entity / Handler / ModerationHandlerInterface.php
1 <?php
2
3 namespace Drupal\content_moderation\Entity\Handler;
4
5 use Drupal\Core\Entity\ContentEntityInterface;
6 use Drupal\Core\Form\FormStateInterface;
7
8 /**
9  * Defines operations that need to vary by entity type.
10  *
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.
14  */
15 interface ModerationHandlerInterface {
16
17   /**
18    * Operates on moderated content entities preSave().
19    *
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.
26    */
27   public function onPresave(ContentEntityInterface $entity, $default_revision, $published_state);
28
29   /**
30    * Alters entity forms to enforce revision handling.
31    *
32    * @param array $form
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
37    *   The form id.
38    *
39    * @see hook_form_alter()
40    */
41   public function enforceRevisionsEntityFormAlter(array &$form, FormStateInterface $form_state, $form_id);
42
43   /**
44    * Alters bundle forms to enforce revision handling.
45    *
46    * @param array $form
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
51    *   The form id.
52    *
53    * @see hook_form_alter()
54    */
55   public function enforceRevisionsBundleFormAlter(array &$form, FormStateInterface $form_state, $form_id);
56
57 }