"Fossies" - the Fresh Open Source Software Archive

Member "drupal-8.9.10/core/modules/content_moderation/src/ModerationInformationInterface.php" (26 Nov 2020, 7832 Bytes) of package /linux/www/drupal-8.9.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "ModerationInformationInterface.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 
    3 namespace Drupal\content_moderation;
    4 
    5 use Drupal\Core\Entity\ContentEntityInterface;
    6 use Drupal\Core\Entity\EntityInterface;
    7 use Drupal\Core\Entity\EntityTypeInterface;
    8 
    9 /**
   10  * Interface for moderation_information service.
   11  */
   12 interface ModerationInformationInterface {
   13 
   14   /**
   15    * Determines if an entity is moderated.
   16    *
   17    * @param \Drupal\Core\Entity\EntityInterface $entity
   18    *   The entity we may be moderating.
   19    *
   20    * @return bool
   21    *   TRUE if this entity is moderated, FALSE otherwise.
   22    */
   23   public function isModeratedEntity(EntityInterface $entity);
   24 
   25   /**
   26    * Determines if an entity type can have moderated entities.
   27    *
   28    * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
   29    *   An entity type object.
   30    *
   31    * @return bool
   32    *   TRUE if this entity type can have moderated entities, FALSE otherwise.
   33    */
   34   public function canModerateEntitiesOfEntityType(EntityTypeInterface $entity_type);
   35 
   36   /**
   37    * Determines if an entity type/bundle entities should be moderated.
   38    *
   39    * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
   40    *   The entity type definition to check.
   41    * @param string $bundle
   42    *   The bundle to check.
   43    *
   44    * @return bool
   45    *   TRUE if an entity type/bundle entities should be moderated, FALSE
   46    *   otherwise.
   47    */
   48   public function shouldModerateEntitiesOfBundle(EntityTypeInterface $entity_type, $bundle);
   49 
   50   /**
   51    * Determines if an entity type has at least one moderated bundle.
   52    *
   53    * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
   54    *   The entity type definition to check.
   55    *
   56    * @return bool
   57    *   TRUE if an entity type has a moderated bundle, FALSE otherwise.
   58    */
   59   public function isModeratedEntityType(EntityTypeInterface $entity_type);
   60 
   61   /**
   62    * Loads the latest revision of a specific entity.
   63    *
   64    * @param string $entity_type_id
   65    *   The entity type ID.
   66    * @param int $entity_id
   67    *   The entity ID.
   68    *
   69    * @return \Drupal\Core\Entity\ContentEntityInterface|null
   70    *   The latest entity revision or NULL, if the entity type / entity doesn't
   71    *   exist.
   72    *
   73    * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
   74    *   RevisionableStorageInterface::getLatestRevisionId and
   75    *   RevisionableStorageInterface::loadRevision instead.
   76    *
   77    * @see https://www.drupal.org/node/3087295
   78    */
   79   public function getLatestRevision($entity_type_id, $entity_id);
   80 
   81   /**
   82    * Returns the revision ID of the latest revision of the given entity.
   83    *
   84    * @param string $entity_type_id
   85    *   The entity type ID.
   86    * @param int $entity_id
   87    *   The entity ID.
   88    *
   89    * @return int
   90    *   The revision ID of the latest revision for the specified entity, or
   91    *   NULL if there is no such entity.
   92    *
   93    * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
   94    *   RevisionableStorageInterface::getLatestRevisionId instead.
   95    *
   96    * @see https://www.drupal.org/node/3087295
   97    */
   98   public function getLatestRevisionId($entity_type_id, $entity_id);
   99 
  100   /**
  101    * Returns the revision ID of the default revision for the specified entity.
  102    *
  103    * @param string $entity_type_id
  104    *   The entity type ID.
  105    * @param int $entity_id
  106    *   The entity ID.
  107    *
  108    * @return int
  109    *   The revision ID of the default revision, or NULL if the entity was
  110    *   not found.
  111    */
  112   public function getDefaultRevisionId($entity_type_id, $entity_id);
  113 
  114   /**
  115    * Returns the revision translation affected translation of a revision.
  116    *
  117    * @param \Drupal\Core\Entity\ContentEntityInterface $entity
  118    *   The content entity.
  119    *
  120    * @return \Drupal\Core\Entity\ContentEntityInterface
  121    *   The revision translation affected translation.
  122    */
  123   public function getAffectedRevisionTranslation(ContentEntityInterface $entity);
  124 
  125   /**
  126    * Determines if an entity is a latest revision.
  127    *
  128    * @param \Drupal\Core\Entity\ContentEntityInterface $entity
  129    *   A revisionable content entity.
  130    *
  131    * @return bool
  132    *   TRUE if the specified object is the latest revision of its entity,
  133    *   FALSE otherwise.
  134    *
  135    * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
  136    *   RevisionableInterface::isLatestRevision instead.
  137    *
  138    * @see https://www.drupal.org/node/3087295
  139    */
  140   public function isLatestRevision(ContentEntityInterface $entity);
  141 
  142   /**
  143    * Determines if a pending revision exists for the specified entity.
  144    *
  145    * @param \Drupal\Core\Entity\ContentEntityInterface $entity
  146    *   The entity which may or may not have a pending revision.
  147    *
  148    * @return bool
  149    *   TRUE if this entity has pending revisions available, FALSE otherwise.
  150    */
  151   public function hasPendingRevision(ContentEntityInterface $entity);
  152 
  153   /**
  154    * Determines if an entity is "live".
  155    *
  156    * A "live" entity revision is one whose latest revision is also the default,
  157    * and whose moderation state, if any, is a published state.
  158    *
  159    * @param \Drupal\Core\Entity\ContentEntityInterface $entity
  160    *   The entity to check.
  161    *
  162    * @return bool
  163    *   TRUE if the specified entity is a live revision, FALSE otherwise.
  164    */
  165   public function isLiveRevision(ContentEntityInterface $entity);
  166 
  167   /**
  168    * Determines if the default revision for the given entity is published.
  169    *
  170    * The default revision is the same as the entity retrieved by "default" from
  171    * the storage handler. If the entity is translated, check if any of the
  172    * translations are published.
  173    *
  174    * @param \Drupal\Core\Entity\ContentEntityInterface $entity
  175    *   The entity being saved.
  176    *
  177    * @return bool
  178    *   TRUE if the default revision is published. FALSE otherwise.
  179    */
  180   public function isDefaultRevisionPublished(ContentEntityInterface $entity);
  181 
  182   /**
  183    * Gets the workflow for the given content entity.
  184    *
  185    * @param \Drupal\Core\Entity\ContentEntityInterface $entity
  186    *   The content entity to get the workflow for.
  187    *
  188    * @return \Drupal\workflows\WorkflowInterface|null
  189    *   The workflow entity. NULL if there is no workflow.
  190    */
  191   public function getWorkflowForEntity(ContentEntityInterface $entity);
  192 
  193   /**
  194    * Gets the workflow for the given entity type and bundle.
  195    *
  196    * @param string $entity_type_id
  197    *   The entity type ID.
  198    * @param string $bundle_id
  199    *   The entity bundle ID.
  200    *
  201    * @return \Drupal\workflows\WorkflowInterface|null
  202    *   The associated workflow. NULL if there is no workflow.
  203    */
  204   public function getWorkflowForEntityTypeAndBundle($entity_type_id, $bundle_id);
  205 
  206   /**
  207    * Gets unsupported features for a given entity type.
  208    *
  209    * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
  210    *   The entity type to get the unsupported features for.
  211    *
  212    * @return array
  213    *   An array of unsupported features for this entity type.
  214    */
  215   public function getUnsupportedFeatures(EntityTypeInterface $entity_type);
  216 
  217   /**
  218    * Gets the original or initial state of the given entity.
  219    *
  220    * When a state is being validated, the original state is used to validate
  221    * that a valid transition exists for target state and the user has access
  222    * to the transition between those two states. If the entity has been
  223    * moderated before, we can load the original unmodified revision and
  224    * translation for this state.
  225    *
  226    * If the entity is new we need to load the initial state from the workflow.
  227    * Even if a value was assigned to the moderation_state field, the initial
  228    * state is used to compute an appropriate transition for the purposes of
  229    * validation.
  230    *
  231    * @param \Drupal\Core\Entity\ContentEntityInterface $entity
  232    *   The content entity to get the workflow for.
  233    *
  234    * @return \Drupal\content_moderation\ContentModerationState
  235    *   The original or default moderation state.
  236    */
  237   public function getOriginalState(ContentEntityInterface $entity);
  238 
  239 }