You are here

public function WorkflowTransition::getEntity in Workflow 7

Same name and namespace in other branches
  1. 7.2 includes/Entity/WorkflowTransition.php \WorkflowTransition::getEntity()

Get/Set the Transitions $entity. IF no arguments are provided, the $entity_type and $entity_id must be known upfront.

Parameters

string $entity_type: If setting an $entity, its entity_type, else empty.

stdClass $entity_id: If setting an $entity, its ID, else empty.

stdClass $entity: If setting an $entity, the object, else empty.

Return value

$entity The entity, that is added to the Transition.

3 calls to WorkflowTransition::getEntity()
WorkflowScheduledTransition::getWorkflowItem in includes/Entity/WorkflowScheduledTransition.php
WorkflowTransition::execute in includes/Entity/WorkflowTransition.php
Execute a transition (change state of a node). @deprecated: workflow_execute_transition() --> WorkflowTransition::execute().
WorkflowTransition::isAllowed in includes/Entity/WorkflowTransition.php
Verifies if the given transition is allowed.

File

includes/Entity/WorkflowTransition.php, line 260
Contains workflow\includes\Entity\WorkflowTransition.

Class

WorkflowTransition
Implements an actual Transition.

Code

public function getEntity() {

  // A correct call, return the $entity.
  if (empty($this->entity)) {
    $entity_type = $this->entity_type;
    $entity_id = $this->entity_id;
    $this->entity = $entity_type == 'node' ? node_load($entity_id) : array_shift(entity_load($entity_type, array(
      $entity_id,
    )));
  }
  return $this->entity;
}