function WorkflowCustomAccessType::workflowAccess

Same name in other branches
  1. 8.9.x core/modules/workflows/tests/modules/workflow_type_test/src/Plugin/WorkflowType/WorkflowCustomAccessType.php \Drupal\workflow_type_test\Plugin\WorkflowType\WorkflowCustomAccessType::workflowAccess()
  2. 10 core/modules/workflows/tests/modules/workflow_type_test/src/Plugin/WorkflowType/WorkflowCustomAccessType.php \Drupal\workflow_type_test\Plugin\WorkflowType\WorkflowCustomAccessType::workflowAccess()
  3. 11.x core/modules/workflows/tests/modules/workflow_type_test/src/Plugin/WorkflowType/WorkflowCustomAccessType.php \Drupal\workflow_type_test\Plugin\WorkflowType\WorkflowCustomAccessType::workflowAccess()

Implements hook_ENTITY_TYPE_access().

See also

workflow_type_test_workflow_access

1 call to WorkflowCustomAccessType::workflowAccess()
workflow_type_test_workflow_access in core/modules/workflows/tests/modules/workflow_type_test/workflow_type_test.module
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 61

Class

WorkflowCustomAccessType
A test workflow with custom state/transition access rules applied.

Namespace

Drupal\workflow_type_test\Plugin\WorkflowType

Code

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.