ParamConverterRouteRequirementInterface.php

Namespace

Drupal\Core\ParamConverter

File

core/lib/Drupal/Core/ParamConverter/ParamConverterRouteRequirementInterface.php

View source
<?php

namespace Drupal\Core\ParamConverter;


/**
 * Interface for param converters providing a route requirement for parameters.
 */
interface ParamConverterRouteRequirementInterface {
  
  /**
   * Returns a regex requirement for a route parameter.
   *
   * @param mixed $definition
   *   The parameter definition provided in the route options.
   * @param string $name
   *   The name of the parameter.
   *
   * @return string|null
   *   A regex pattern (without delimiters or anchors) suitable for
   *   Route::setRequirement(), or NULL if no requirement can be determined.
   */
  public function getRouteRequirement($definition, $name) : ?string;

}

Interfaces

Title Deprecated Summary
ParamConverterRouteRequirementInterface Interface for param converters providing a route requirement for parameters.

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