You are here

public function RouteProcessor::processOutbound in Ubercart 8.4

Processes the outbound route.

Parameters

string $route_name: The route name.

\Symfony\Component\Routing\Route $route: The outbound route to process.

array $parameters: An array of parameters to be passed to the route compiler. Passed by reference.

\Drupal\Core\Render\BubbleableMetadata $bubbleable_metadata: (optional) Object to collect route processors' bubbleable metadata.

Return value

The processed path.

Overrides OutboundRouteProcessorInterface::processOutbound

File

uc_catalog/src/Access/RouteProcessor.php, line 46

Class

RouteProcessor
Processes the outbound path by resolving it to the catalog page.

Namespace

Drupal\uc_catalog\Access

Code

public function processOutbound($route_name, Route $route, array &$parameters, BubbleableMetadata $bubbleable_metadata = NULL) {
  if ($route_name == 'entity.taxonomy_term.canonical' && !empty($parameters['taxonomy_term'])) {
    if ($vid = $this->configFactory
      ->get('uc_catalog.settings')
      ->get('vocabulary')) {
      if ($this->entityTypeManager
        ->getStorage('taxonomy_term')
        ->load($parameters['taxonomy_term'])
        ->bundle() == $vid) {
        $route
          ->setPath('/catalog/{taxonomy_term}');
      }
    }
  }
}