interface WorkflowTransitionInterface in Workflow 8
Defines a common interface for Workflow*Transition* objects.
Hierarchy
- interface \Drupal\workflow\Entity\WorkflowConfigTransitionInterface; interface \Drupal\Core\Entity\FieldableEntityInterface; interface \Drupal\user\EntityOwnerInterface
- interface \Drupal\workflow\Entity\WorkflowTransitionInterface
Expanded class hierarchy of WorkflowTransitionInterface
All classes that implement WorkflowTransitionInterface
See also
\Drupal\workflow\Entity\WorkflowConfigTransition
\Drupal\workflow\Entity\WorkflowTransition
\Drupal\workflow\Entity\WorkflowScheduledTransition
5 files declare their use of WorkflowTransitionInterface
- workflow.api.php in ./
workflow.api.php - Hooks provided by the workflow module.
- workflow.form.inc in ./
workflow.form.inc - Contains helper functions for WorkflowTransitionForm.
- workflow.module in ./
workflow.module - Support workflows made up of arbitrary states.
- WorkflowTransitionRevertForm.php in src/
Form/ WorkflowTransitionRevertForm.php - workflow_devel.module in modules/
workflow_devel/ workflow_devel.module - Development tools for Workflow.
File
- src/
Entity/ WorkflowTransitionInterface.php, line 16
Namespace
Drupal\workflow\EntityView source
interface WorkflowTransitionInterface extends WorkflowConfigTransitionInterface, FieldableEntityInterface, EntityOwnerInterface {
/**
* Helper function for __construct. Used for all children of WorkflowTransition (aka WorkflowScheduledTransition)
*
* Usage:
* $transition = WorkflowTransition::create([$current_sid, 'field_name' => $field_name]);
* $transition->setTargetEntity($entity);
* $transition->setValues($new_sid, $user->id(), REQUEST_TIME, $comment);
*
* @param string $to_sid
* @param int $uid
* @param int $timestamp
* @param string $comment
* @param bool $force_create
*/
public function setValues($to_sid, $uid = NULL, $timestamp = NULL, $comment = '', $force_create = FALSE);
/**
* Load (Scheduled) WorkflowTransitions, most recent first.
*
* @param string $entity_type
* @param int $entity_id
* @param array $revision_ids
* @param string $field_name
* @param string $langcode
* @param string $sort
* @param string $transition_type
*
* @return \Drupal\workflow\Entity\WorkflowTransitionInterface
* Object representing one row from the {workflow_transition_history} table.
*/
public static function loadByProperties($entity_type, $entity_id, array $revision_ids = [], $field_name = '', $langcode = '', $sort = 'ASC', $transition_type = '');
/**
* Given an entity, get all transitions for it.
*
* Since this may return a lot of data, a limit is included to allow for only one result.
*
* @param string $entity_type
* @param int[] $entity_ids
* @param int[] $revision_ids
* @param string $field_name
* Optional. Can be NULL, if you want to load any field.
* @param string $langcode
* Optional. Can be empty, if you want to load any language.
* @param int $limit
* Optional. Can be NULL, if you want to load all transitions.
* @param string $sort
* Optional sort order {'ASC'|'DESC'}.
* @param string $transition_type
* The type of the transition to be fetched.
*
* @return WorkflowTransitionInterface[]
* An array of transitions.
*/
public static function loadMultipleByProperties($entity_type, array $entity_ids, array $revision_ids = [], $field_name = '', $langcode = '', $limit = NULL, $sort = 'ASC', $transition_type = '');
/**
* Execute a transition (change state of an entity).
*
* A Scheduled Transition shall only be saved, unless the
* 'schedule' property is set.
*
* @param bool $force
* If set to TRUE, workflow permissions will be ignored.
*
* @return string
* New state ID. If execution failed, old state ID is returned,
*
* @usage
* $transition->schedule(FALSE);
* $to_sid = $transition->execute(TRUE);
*/
public function execute($force = FALSE);
/**
* Executes a transition (change state of an entity), from OUTSIDE the entity.
*
* Use $transition->executeAndUpdateEntity() to start a State Change from
* outside an entity, e.g., workflow_cron().
* Use $transition->execute() to start a State Change from within an entity.
*
* A Scheduled Transition ($transition->isScheduled() == TRUE) will be
* un-scheduled and saved in the history table.
* The entity will not be updated.
* If $transition->isScheduled() == FALSE, the Transition will be
* removed from the {workflow_transition_scheduled} table (if necessary),
* and added to {workflow_transition_history} table.
* Then the entity wil be updated to reflect the new status.
*
* @param bool $force
* If set to TRUE, workflow permissions will be ignored.
*
* @return string
* The resulting WorkflowState id.
*
* @usage
* $to_sid = $transition->->executeAndUpdateEntity($force);
*
* @see workflow_execute_transition()
*/
public function executeAndUpdateEntity($force = FALSE);
/**
* Invokes 'transition post'.
*
* Adds the possibility to invoke the hook from elsewhere.
*
* @param bool $force
*/
public function post_execute($force = FALSE);
/**
* Sets the Entity, that is added to the Transition.
*
* Also sets all dependent fields, that will be saved in tables {workflow_transition_*}.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* The Entity ID or the Entity object, to add to the Transition.
*
* @return object
* The Entity, that is added to the Transition.
*/
public function setTargetEntity(EntityInterface $entity);
/**
* Returns the entity to which the workflow is attached.
*
* @return \Drupal\Core\Entity\EntityInterface
* The entity to which the workflow is attached.
*/
public function getTargetEntity();
/**
* Returns the ID of the entity to which the workflow is attached.
*
* @return int
* The ID of the entity to which the workflow is attached.
*/
public function getTargetEntityId();
/**
* Returns the type of the entity to which the workflow is attached.
*
* @return string
* An entity type.
*/
public function getTargetEntityTypeId();
/**
* Get the field_name for which the Transition is valid.
*
* @return string
* The field_name, that is added to the Transition.
*/
public function getFieldName();
/**
* Get the language code for which the Transition is valid.
*
* @return string
* $langcode
*
* @todo OK?? Shouldn't we use entity's language() method for langcode?
*/
public function getLangcode();
/**
* Get the comment of the Transition.
*
* @return
* The comment
*/
public function getComment();
/**
* Get the comment of the Transition.
*
* @param $value
* The new comment.
*
* @return WorkflowTransitionInterface
*/
public function setComment($value);
/**
* Returns the time on which the transitions was or will be executed.
*
* @return
*/
public function getTimestamp();
/**
* Returns the human-readable time.
*
* @return string
*/
public function getTimestampFormatted();
/**
* Returns the time on which the transitions was or will be executed.
*
* @param $value
* The new timestamp.
*
* @return WorkflowTransitionInterface
*/
public function setTimestamp($value);
/**
* Returns if this is a Scheduled Transition.
*
* @return bool
*/
public function isScheduled();
/**
* Returns if this is a revertable Transition on the History tab.
*
* @return bool
*/
public function isRevertable();
/**
* Sets the Transition to be scheduled or not.
*
* @param bool $schedule
*
* @return WorkflowTransitionInterface
*/
public function schedule($schedule = TRUE);
/**
* Set the 'isExecuted' property.
*
* @param bool $isExecuted
*
* @return WorkflowTransitionInterface
*/
public function setExecuted($isExecuted = TRUE);
/**
* Returns if this is an Executed Transition.
*
* @return bool
*/
public function isExecuted();
/**
* A transition may be forced skipping checks.
*
* @return bool
* If the transition is forced. (Allow not-configured transitions).
*/
public function isForced();
/**
* Set if a transition must be executed, even if transition is invalid or user not authorized.
*
* @param bool $force
*
* @return object
* The transition itself.
*/
public function force($force = TRUE);
/**
* Helper/debugging function. Shows simple contents of Transition.
*
* @param string $function
*/
public function dpm($function = '');
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AccessibleInterface:: |
public | function | Checks data value access. | 9 |
CacheableDependencyInterface:: |
public | function | The cache contexts associated with this object. | 34 |
CacheableDependencyInterface:: |
public | function | The maximum age for which this object may be cached. | 34 |
CacheableDependencyInterface:: |
public | function | The cache tags associated with this object. | 27 |
EntityInterface:: |
public | function | Gets the bundle of the entity. | 2 |
EntityInterface:: |
public static | function | Constructs a new entity object, without permanently saving it. | 2 |
EntityInterface:: |
public | function | Creates a duplicate of the entity. | 2 |
EntityInterface:: |
public | function | Deletes an entity permanently. | 2 |
EntityInterface:: |
public | function | Enforces an entity to be new. | 2 |
EntityInterface:: |
public | function | Returns the cache tags that should be used to invalidate caches. | 2 |
EntityInterface:: |
public | function | Gets the key that is used to store configuration dependencies. | 2 |
EntityInterface:: |
public | function | Gets the configuration dependency name. | 2 |
EntityInterface:: |
public | function | Gets the configuration target identifier for the entity. | 2 |
EntityInterface:: |
public | function | Gets the entity type definition. | 2 |
EntityInterface:: |
public | function | Gets the ID of the type of the entity. | 2 |
EntityInterface:: |
public | function | Gets the original ID. | 2 |
EntityInterface:: |
public | function | Gets a typed data object for this entity object. | 2 |
EntityInterface:: |
public | function | Indicates if a link template exists for a given key. | 2 |
EntityInterface:: |
public | function | Gets the identifier. | 2 |
EntityInterface:: |
public | function | Determines whether the entity is new. | 2 |
EntityInterface:: |
public | function | Gets the label of the entity. | 2 |
EntityInterface:: |
public | function | Gets the language of the entity. | 2 |
EntityInterface:: |
public | function | Deprecated way of generating a link to the entity. See toLink(). | 2 |
EntityInterface:: |
public static | function | Loads an entity. | 2 |
EntityInterface:: |
public static | function | Loads one or more entities. | 2 |
EntityInterface:: |
public | function | Acts on a created entity before hooks are invoked. | 2 |
EntityInterface:: |
public static | function | Acts on deleted entities before the delete hook is invoked. | 2 |
EntityInterface:: |
public static | function | Acts on loaded entities. | 3 |
EntityInterface:: |
public | function | Acts on a saved entity before the insert or update hook is invoked. | 2 |
EntityInterface:: |
public static | function | Changes the values of an entity before it is created. | 2 |
EntityInterface:: |
public static | function | Acts on entities before they are deleted and before hooks are invoked. | 2 |
EntityInterface:: |
public | function | Acts on an entity before the presave hook is invoked. | 2 |
EntityInterface:: |
public | function | Gets a list of entities referenced by this entity. | 2 |
EntityInterface:: |
public | function | Saves an entity permanently. | 2 |
EntityInterface:: |
public | function | Sets the original ID. | 2 |
EntityInterface:: |
public | function | Generates the HTML for a link to this entity. | 2 |
EntityInterface:: |
public | function | Gets the URL object for the entity. | 2 |
EntityInterface:: |
public | function | Gets a list of URI relationships supported by this entity. | 2 |
EntityInterface:: |
public | function | Gets the public URL for this entity. | 2 |
EntityInterface:: |
public | function | Gets the URL object for the entity. | 2 |
EntityInterface:: |
public | function | Gets the entity UUID (Universally Unique Identifier). | 2 |
EntityOwnerInterface:: |
public | function | Returns the entity owner's user entity. | 1 |
EntityOwnerInterface:: |
public | function | Returns the entity owner's user ID. | 1 |
EntityOwnerInterface:: |
public | function | Sets the entity owner's user entity. | 1 |
EntityOwnerInterface:: |
public | function | Sets the entity owner's user ID. | 1 |
FieldableEntityInterface:: |
public static | function | Provides base field definitions for an entity type. | 2 |
FieldableEntityInterface:: |
public static | function | Provides field definitions for a specific bundle. | 2 |
FieldableEntityInterface:: |
public | function | Gets a field item list. | 1 |
FieldableEntityInterface:: |
public | function | Gets the definition of a contained field. | 1 |
FieldableEntityInterface:: |
public | function | Gets an array of field definitions of all contained fields. | 1 |
FieldableEntityInterface:: |
public | function | Gets an array of all field item lists. | 1 |
FieldableEntityInterface:: |
public | function | Gets an array of field item lists for translatable fields. | 1 |
FieldableEntityInterface:: |
public | function | Determines whether the entity has a field with the given name. | 1 |
FieldableEntityInterface:: |
public | function | Checks whether entity validation is required before saving the entity. | 1 |
FieldableEntityInterface:: |
public | function | Reacts to changes to a field. | 1 |
FieldableEntityInterface:: |
public | function | Sets a field value. | 1 |
FieldableEntityInterface:: |
public | function | Sets whether entity validation is required before saving the entity. | 1 |
FieldableEntityInterface:: |
public | function |
Gets an array of all field values. Overrides EntityInterface:: |
|
FieldableEntityInterface:: |
public | function | Validates the currently set values. | 1 |
RefinableCacheableDependencyInterface:: |
public | function | Adds a dependency on an object: merges its cacheability metadata. | 1 |
RefinableCacheableDependencyInterface:: |
public | function | Adds cache contexts. | 1 |
RefinableCacheableDependencyInterface:: |
public | function | Adds cache tags. | 1 |
RefinableCacheableDependencyInterface:: |
public | function | Merges the maximum age (in seconds) with the existing maximum age. | 1 |
WorkflowConfigTransitionInterface:: |
public | function | 2 | |
WorkflowConfigTransitionInterface:: |
public | function | 2 | |
WorkflowConfigTransitionInterface:: |
public | function | 2 | |
WorkflowConfigTransitionInterface:: |
public | function | 2 | |
WorkflowConfigTransitionInterface:: |
public | function | Returns the Workflow object of this object. | |
WorkflowConfigTransitionInterface:: |
public | function | Returns the Workflow ID of this object. | |
WorkflowConfigTransitionInterface:: |
public | function | Determines if the State changes by this Transition. | 2 |
WorkflowConfigTransitionInterface:: |
public | function | Determines if the current transition between 2 states is allowed. | 2 |
WorkflowTransitionInterface:: |
public | function | Helper/debugging function. Shows simple contents of Transition. | 1 |
WorkflowTransitionInterface:: |
public | function | Execute a transition (change state of an entity). | 1 |
WorkflowTransitionInterface:: |
public | function | Executes a transition (change state of an entity), from OUTSIDE the entity. | 1 |
WorkflowTransitionInterface:: |
public | function | Set if a transition must be executed, even if transition is invalid or user not authorized. | 1 |
WorkflowTransitionInterface:: |
public | function | Get the comment of the Transition. | 1 |
WorkflowTransitionInterface:: |
public | function | Get the field_name for which the Transition is valid. | 1 |
WorkflowTransitionInterface:: |
public | function | Get the language code for which the Transition is valid. | 1 |
WorkflowTransitionInterface:: |
public | function | Returns the entity to which the workflow is attached. | 1 |
WorkflowTransitionInterface:: |
public | function | Returns the ID of the entity to which the workflow is attached. | 1 |
WorkflowTransitionInterface:: |
public | function | Returns the type of the entity to which the workflow is attached. | 1 |
WorkflowTransitionInterface:: |
public | function | Returns the time on which the transitions was or will be executed. | 1 |
WorkflowTransitionInterface:: |
public | function | Returns the human-readable time. | 1 |
WorkflowTransitionInterface:: |
public | function | Returns if this is an Executed Transition. | 1 |
WorkflowTransitionInterface:: |
public | function | A transition may be forced skipping checks. | 1 |
WorkflowTransitionInterface:: |
public | function | Returns if this is a revertable Transition on the History tab. | 1 |
WorkflowTransitionInterface:: |
public | function | Returns if this is a Scheduled Transition. | 1 |
WorkflowTransitionInterface:: |
public static | function | Load (Scheduled) WorkflowTransitions, most recent first. | 1 |
WorkflowTransitionInterface:: |
public static | function | Given an entity, get all transitions for it. | 1 |
WorkflowTransitionInterface:: |
public | function | Invokes 'transition post'. | 1 |
WorkflowTransitionInterface:: |
public | function | Sets the Transition to be scheduled or not. | 1 |
WorkflowTransitionInterface:: |
public | function | Get the comment of the Transition. | 1 |
WorkflowTransitionInterface:: |
public | function | Set the 'isExecuted' property. | 1 |
WorkflowTransitionInterface:: |
public | function | Sets the Entity, that is added to the Transition. | 1 |
WorkflowTransitionInterface:: |
public | function | Returns the time on which the transitions was or will be executed. | 1 |
WorkflowTransitionInterface:: |
public | function | Helper function for __construct. Used for all children of WorkflowTransition (aka WorkflowScheduledTransition) | 1 |