public static function WorkflowTransition::loadMultipleByProperties in Workflow 8
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.
Parameters
string $entity_type:
int[] $entity_ids:
int[] $revision_ids:
string $field_name: Optional. Can be NULL, if you want to load any field.
string $langcode: Optional. Can be empty, if you want to load any language.
int $limit: Optional. Can be NULL, if you want to load all transitions.
string $sort: Optional sort order {'ASC'|'DESC'}.
string $transition_type: The type of the transition to be fetched.
Return value
WorkflowTransitionInterface[] An array of transitions.
Overrides WorkflowTransitionInterface::loadMultipleByProperties
5 calls to WorkflowTransition::loadMultipleByProperties()
- WorkflowScheduledTransition::loadMultipleByProperties in src/
Entity/ WorkflowScheduledTransition.php - Given an entity, get all transitions for it.
- WorkflowStateHistoryFormatter::viewElements in src/
Plugin/ Field/ FieldFormatter/ WorkflowStateHistoryFormatter.php - Builds a renderable array for a field value.
- WorkflowTransition::loadByProperties in src/
Entity/ WorkflowTransition.php - Load (Scheduled) WorkflowTransitions, most recent first.
- WorkflowTransitionListBuilder::load in src/
WorkflowTransitionListBuilder.php - Loads entities of this type from storage for listing.
- workflow_entity_delete in ./
workflow.module - Implements hook_entity_delete().
1 method overrides WorkflowTransition::loadMultipleByProperties()
- WorkflowScheduledTransition::loadMultipleByProperties in src/
Entity/ WorkflowScheduledTransition.php - Given an entity, get all transitions for it.
File
- src/
Entity/ WorkflowTransition.php, line 283
Class
- WorkflowTransition
- Implements an actual, executed, Transition.
Namespace
Drupal\workflow\EntityCode
public static function loadMultipleByProperties($entity_type, array $entity_ids, array $revision_ids = [], $field_name = '', $langcode = '', $limit = NULL, $sort = 'ASC', $transition_type = 'workflow_transition') {
/** @var \Drupal\Core\Entity\Query\QueryInterface $query */
$query = \Drupal::entityQuery($transition_type)
->condition('entity_type', $entity_type)
->sort('timestamp', $sort)
->addTag($transition_type);
if (!empty($entity_ids)) {
$query
->condition('entity_id', $entity_ids, 'IN');
}
if (!empty($revision_ids)) {
$query
->condition('revision_id', $entity_ids, 'IN');
}
if ($field_name != '') {
$query
->condition('field_name', $field_name, '=');
}
if ($langcode != '') {
$query
->condition('langcode', $langcode, '=');
}
if ($limit) {
$query
->range(0, $limit);
}
if ($transition_type == 'workflow_transition') {
$query
->sort('hid', 'DESC');
}
$ids = $query
->execute();
$transitions = self::loadMultiple($ids);
return $transitions;
}