getOperation($route_match); if (!preg_match('/^(?add|update|delete)-(?state|transition)$/', $workflow_operation, $matches)) { throw new \Exception("Invalid _workflow_access operation '$workflow_operation' specified for route '{$route_match->getRouteName()}'."); } $parameters = $route_match->getParameters(); $workflow = $parameters->get('workflow'); if ($workflow && $matches['operation'] === 'add') { return $workflow->access($workflow_operation, $account, TRUE); } if ($workflow && $type = $parameters->get(sprintf('workflow_%s', $matches['type']))) { return $workflow->access(sprintf('%s:%s', $workflow_operation, $type), $account, TRUE); } return AccessResult::neutral(); } /** * Get the operation that will be used for the access check. * * @param \Drupal\Core\Routing\RouteMatchInterface $route_match * The parametrized route. * * @return string * The access operation. */ protected function getOperation(RouteMatchInterface $route_match) { return $route_match->getRouteObject()->getRequirement('_workflow_access'); } }