You are here

public function WorkflowScheduledTransition::getWorkflowItem in Workflow 7

File

includes/Entity/WorkflowScheduledTransition.php, line 143
Contains workflow\includes\Entity\WorkflowScheduledTransition.

Class

WorkflowScheduledTransition

Code

public function getWorkflowItem() {
  $workflowItem = NULL;
  if (!empty($this->field_name)) {

    // @todo: read $field_name directly from table.
  }
  $entity_type = $this->entity_type;
  $entity = $this
    ->getEntity();
  $entity_bundle = $this
    ->getEntity()->type;
  foreach (field_info_instances($entity_type, $entity_bundle) as $field_name => $field_instance) {
    $field_info = field_info_field($field_instance['field_name']);
    $field_type = $field_info['type'];
    if ($field_type == 'workflow') {

      // Set cache.
      $this->field_name = $field_name;

      // Prepare return value.
      $workflowItem = new WorkflowItem($field_info, $field_instance, $entity_type, $this
        ->getEntity());
    }
  }
  return $workflowItem;
}