routeProvider example


  public function getRouteName() {
    return $this->pluginDefinition['route_name'];
  }

  /** * {@inheritdoc} */
  public function getRouteParameters(RouteMatchInterface $route_match) {
    $route_parameters = $this->pluginDefinition['route_parameters'] ?? [];
    $route = $this->routeProvider()->getRouteByName($this->getRouteName());
    $variables = $route->compile()->getVariables();

    // Normally the \Drupal\Core\ParamConverter\ParamConverterManager has     // run, and the route parameters have been upcast. The original values can     // be retrieved from the raw parameters. For example, if the route's path is     // /filter/tips/{filter_format} and the path is /filter/tips/plain_text then     // $raw_parameters->get('filter_format') == 'plain_text'. Parameters that     // are not represented in the route path as slugs might be added by a route     // enhancer and will not be present in the raw parameters.     $raw_parameters = $route_match->getRawParameters();
    $parameters = $route_match->getParameters();

    
Home | Imprint | This part of the site doesn't use cookies.