0188a87e2004e70eff25c39ac0666e2c9cc5bee8
[yaffs-website] / web / core / modules / content_moderation / src / Plugin / WorkflowType / ContentModerationInterface.php
1 <?php
2
3 namespace Drupal\content_moderation\Plugin\WorkflowType;
4
5 use Drupal\workflows\WorkflowTypeInterface;
6
7 /**
8  * Interface for ContentModeration WorkflowType plugin.
9  */
10 interface ContentModerationInterface extends WorkflowTypeInterface {
11
12   /**
13    * Gets the entity types the workflow is applied to.
14    *
15    * @return string[]
16    *   The entity types the workflow is applied to.
17    */
18   public function getEntityTypes();
19
20   /**
21    * Gets any bundles the workflow is applied to for the given entity type.
22    *
23    * @param string $entity_type_id
24    *   The entity type ID to get the bundles for.
25    *
26    * @return string[]
27    *   The bundles of the entity type the workflow is applied to or an empty
28    *   array if the entity type is not applied to the workflow.
29    */
30   public function getBundlesForEntityType($entity_type_id);
31
32   /**
33    * Checks if the workflow applies to the supplied entity type and bundle.
34    *
35    * @param string $entity_type_id
36    *   The entity type ID to check.
37    * @param string $bundle_id
38    *   The bundle ID to check.
39    *
40    * @return bool
41    *   TRUE if the workflow applies to the supplied entity type ID and bundle
42    *   ID. FALSE if not.
43    */
44   public function appliesToEntityTypeAndBundle($entity_type_id, $bundle_id);
45
46   /**
47    * Removes an entity type ID / bundle ID from the workflow.
48    *
49    * @param string $entity_type_id
50    *   The entity type ID to remove.
51    * @param string $bundle_id
52    *   The bundle ID to remove.
53    */
54   public function removeEntityTypeAndBundle($entity_type_id, $bundle_id);
55
56   /**
57    * Add an entity type ID / bundle ID to the workflow.
58    *
59    * @param string $entity_type_id
60    *   The entity type ID to add. It is responsibility of the caller to provide
61    *   a valid entity type ID.
62    * @param string $bundle_id
63    *   The bundle ID to add. It is responsibility of the caller to provide a
64    *   valid bundle ID.
65    */
66   public function addEntityTypeAndBundle($entity_type_id, $bundle_id);
67
68   /**
69    * {@inheritdoc}
70    *
71    * @param $entity
72    *   Content Moderation uses this parameter to determine the initial state
73    *   based on publishing status.
74    */
75   public function getInitialState($entity = NULL);
76
77 }