You are here

interface RouteMatchInterface in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Routing/RouteMatchInterface.php \Drupal\Core\Routing\RouteMatchInterface

Provides an interface for classes representing the result of routing.

Routing is the process of selecting the best matching candidate from a collection of routes for an incoming request. The relevant properties of a request include the path as well as a list of raw parameter values derived from the URL. If an appropriate route is found, raw parameter values will be upcast automatically if possible.

The route match object contains useful information about the selected route as well as the raw and upcast parameters derived from the incoming request.

Hierarchy

Expanded class hierarchy of RouteMatchInterface

All classes that implement RouteMatchInterface

Related topics

215 files declare their use of RouteMatchInterface
AccessArgumentsResolverFactory.php in core/lib/Drupal/Core/Access/AccessArgumentsResolverFactory.php
AccessArgumentsResolverFactoryInterface.php in core/lib/Drupal/Core/Access/AccessArgumentsResolverFactoryInterface.php
AccessManager.php in core/lib/Drupal/Core/Access/AccessManager.php
AccessManagerInterface.php in core/lib/Drupal/Core/Access/AccessManagerInterface.php
action.module in core/modules/action/action.module
This is the Actions module for executing stored actions.

... See full list

File

core/lib/Drupal/Core/Routing/RouteMatchInterface.php, line 20

Namespace

Drupal\Core\Routing
View source
interface RouteMatchInterface {

  /**
   * Returns the route name.
   *
   * @return string|null
   *   The route name. NULL if no route is matched.
   */
  public function getRouteName();

  /**
   * Returns the route object.
   *
   * @return \Symfony\Component\Routing\Route|null
   *   The route object. NULL if no route is matched.
   */
  public function getRouteObject();

  /**
   * Returns the processed value of a named route parameter.
   *
   * Raw URL parameters are processed by the parameter conversion system, which
   * does operations such as converting entity ID parameters to fully-loaded
   * entities. For example, the path node/12345 would have a raw node ID
   * parameter value of 12345, while the processed parameter value would be the
   * corresponding loaded node object.
   *
   * @param string $parameter_name
   *   The parameter name.
   *
   * @return mixed|null
   *   The parameter value. NULL if the route doesn't define the parameter or
   *   if the parameter value can't be determined from the request.
   *
   * @see \Drupal\Core\Routing\RouteMatchInterface::getRawParameter()
   */
  public function getParameter($parameter_name);

  /**
   * Returns the bag of all processed route parameters.
   *
   * Raw URL parameters are processed by the parameter conversion system, which
   * does operations such as converting entity ID parameters to fully-loaded
   * entities. For example, the path node/12345 would have a raw node ID
   * parameter value of 12345, while the processed parameter value would be the
   * corresponding loaded node object.
   *
   * @return \Symfony\Component\HttpFoundation\ParameterBag
   *   The parameter bag.
   *
   * @see \Drupal\Core\Routing\RouteMatchInterface::getRawParameters()
   */
  public function getParameters();

  /**
   * Returns the raw value of a named route parameter.
   *
   * @param string $parameter_name
   *   The parameter name.
   *
   * @return string|null
   *   The raw (non-upcast) parameter value. NULL if the route doesn't define
   *   the parameter or if the raw parameter value can't be determined from the
   *   request.
   *
   * @see \Drupal\Core\Routing\RouteMatchInterface::getParameter()
   */
  public function getRawParameter($parameter_name);

  /**
   * Returns the bag of all raw route parameters.
   *
   * @return \Symfony\Component\HttpFoundation\ParameterBag
   *   The parameter bag.
   *
   * @see \Drupal\Core\Routing\RouteMatchInterface::getParameters()
   */
  public function getRawParameters();

}

Members

Namesort descending Modifiers Type Description Overrides
RouteMatchInterface::getParameter public function Returns the processed value of a named route parameter. 3
RouteMatchInterface::getParameters public function Returns the bag of all processed route parameters. 3
RouteMatchInterface::getRawParameter public function Returns the raw value of a named route parameter. 3
RouteMatchInterface::getRawParameters public function Returns the bag of all raw route parameters. 3
RouteMatchInterface::getRouteName public function Returns the route name. 3
RouteMatchInterface::getRouteObject public function Returns the route object. 3