public static function WorkflowState::sort in Workflow 8
Helper callback for uasort() to sort configuration entities by weight and label.
Overrides ConfigEntityBase::sort
File
- src/
Entity/ WorkflowState.php, line 224
Class
- WorkflowState
- Workflow configuration entity to persistently store configuration.
Namespace
Drupal\workflow\EntityCode
public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b) {
/** @var \Drupal\workflow\Entity\WorkflowState $a */
/** @var \Drupal\workflow\Entity\WorkflowState $b */
$a_wid = $a
->getWorkflowId();
$b_wid = $b
->getWorkflowId();
if ($a_wid == $b_wid) {
$a_weight = $a
->getWeight();
$b_weight = $b
->getWeight();
return $a_weight < $b_weight ? -1 : 1;
}
return $a_wid < $b_wid ? -1 : 1;
}