By jsacksick on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x-1.x
Introduced in version:
8.x-1.3
Issue links:
Description:
Applying an invalid transition via the applyTransition() or applyTransitionById()methods will throw an InvalidArgumentException exception from now on.
Before applying any transition, one must ensure the transition about to be applied is "allowed" by calling the isTransitionAllowed() method, like the following:
$state_item = $entity->get('field_state')->first();
// Where 'foo' is the $transition_id.
if ($state_item->isTransitionAllowed('foo') {
$state_item->applyTransitionById('foo');
}
Impacts:
Module developers