class FulfillmentGuard in State Machine 8
Hierarchy
- class \Drupal\state_machine_test\Guard\FulfillmentGuard implements GuardInterface
Expanded class hierarchy of FulfillmentGuard
1 string reference to 'FulfillmentGuard'
- state_machine_test.services.yml in tests/
modules/ state_machine_test/ state_machine_test.services.yml - tests/modules/state_machine_test/state_machine_test.services.yml
1 service uses FulfillmentGuard
- state_machine_test.fulfillment_guard in tests/
modules/ state_machine_test/ state_machine_test.services.yml - Drupal\state_machine_test\Guard\FulfillmentGuard
File
- tests/
modules/ state_machine_test/ src/ Guard/ FulfillmentGuard.php, line 10
Namespace
Drupal\state_machine_test\GuardView source
class FulfillmentGuard implements GuardInterface {
/**
* {@inheritdoc}
*/
public function allowed(WorkflowTransition $transition, WorkflowInterface $workflow, EntityInterface $entity) {
// Don't allow entities in fulfillment to be cancelled.
if ($transition
->getId() == 'cancel' && $entity->field_state
->first()->value == 'fulfillment') {
return FALSE;
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FulfillmentGuard:: |
public | function |
Checks whether the given transition is allowed. Overrides GuardInterface:: |