function WorkflowTypeTestHooks::workflowAccess

Implements hook_ENTITY_TYPE_access() for the Workflow entity type.

Attributes

#[Hook('workflow_access')]

File

core/modules/workflows/tests/modules/workflow_type_test/src/Hook/WorkflowTypeTestHooks.php, line 34

Class

WorkflowTypeTestHooks
Hook implementations for workflow_type_test.

Namespace

Drupal\workflow_type_test\Hook

Code

public function workflowAccess(WorkflowInterface $entity, $operation, AccountInterface $account) : AccessResultInterface {
  if ($entity->getTypePlugin()
    ->getPluginId() === 'workflow_custom_access_type') {
    return WorkflowCustomAccessType::workflowAccess($entity, $operation, $account);
  }
  return AccessResult::neutral();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.