function WorkflowCustomAccessType::workflowAccess
Implements hook_ENTITY_TYPE_access().
See also
workflow_type_test_workflow_access
1 call to WorkflowCustomAccessType::workflowAccess()
- WorkflowTypeTestHooks::workflowAccess in core/
modules/ workflows/ tests/ modules/ workflow_type_test/ src/ Hook/ WorkflowTypeTestHooks.php - Implements hook_ENTITY_TYPE_access() for the Workflow entity type.
File
-
core/
modules/ workflows/ tests/ modules/ workflow_type_test/ src/ Plugin/ WorkflowType/ WorkflowCustomAccessType.php, line 64
Class
- WorkflowCustomAccessType
- A test workflow with custom state/transition access rules applied.
Namespace
Drupal\workflow_type_test\Plugin\WorkflowTypeCode
public static function workflowAccess(WorkflowInterface $entity, $operation, AccountInterface $account) {
$forbidden_operations = \Drupal::state()->get('workflow_type_test_forbidden_operations', []);
return in_array($operation, $forbidden_operations, TRUE) ? AccessResult::forbidden() : AccessResult::neutral();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.