class WorkflowTypeTestHooks

Hook implementations for workflow_type_test.

Hierarchy

Expanded class hierarchy of WorkflowTypeTestHooks

File

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

Namespace

Drupal\workflow_type_test\Hook
View source
class WorkflowTypeTestHooks {
  
  /**
   * Implements hook_workflow_type_info_alter().
   */
  public function workflowTypeInfoAlter(&$definitions) : void {
    // Allow tests to override the workflow type definitions.
    $state = \Drupal::state();
    if ($state->get('workflow_type_test.plugin_definitions') !== NULL) {
      $definitions = $state->get('workflow_type_test.plugin_definitions');
    }
  }
  
  /**
   * Implements hook_ENTITY_TYPE_access() for the Workflow entity type.
   */
  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();
  }

}

Members

Title Sort descending Modifiers Object type Summary
WorkflowTypeTestHooks::workflowAccess public function Implements hook_ENTITY_TYPE_access() for the Workflow entity type.
WorkflowTypeTestHooks::workflowTypeInfoAlter public function Implements hook_workflow_type_info_alter().

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