You are here

public function FormStateValueResolver::supports in MongoDB 8.2

File

modules/mongodb_watchdog/src/Controller/ArgumentResolver/FormStateValueResolver.php, line 23

Class

FormStateValueResolver
Yields a form_state argument for FormStateInterface $formState arguments.

Namespace

Drupal\mongodb_watchdog\Controller\ArgumentResolver

Code

public function supports(Request $request, ArgumentMetadata $argument) {
  $argumentInterfaceMatches = $argument
    ->getType() === FormStateInterface::class;
  $requestAttributeExists = $request->attributes
    ->has(static::NAME_LEGACY);
  return $argumentInterfaceMatches || $requestAttributeExists;
}