class RouteProcessor in Ubercart 8.4
Processes the outbound path by resolving it to the catalog page.
Hierarchy
- class \Drupal\uc_catalog\Access\RouteProcessor implements OutboundRouteProcessorInterface
Expanded class hierarchy of RouteProcessor
1 string reference to 'RouteProcessor'
- uc_catalog.services.yml in uc_catalog/
uc_catalog.services.yml - uc_catalog/uc_catalog.services.yml
1 service uses RouteProcessor
File
- uc_catalog/
src/ Access/ RouteProcessor.php, line 14
Namespace
Drupal\uc_catalog\AccessView source
class RouteProcessor implements OutboundRouteProcessorInterface {
/**
* The config factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* The entity type manager service.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Constructs a RouteProcessor object.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager service.
*/
public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager) {
$this->configFactory = $config_factory;
$this->entityTypeManager = $entity_type_manager;
}
/**
* {@inheritdoc}
*/
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}');
}
}
}
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RouteProcessor:: |
protected | property | The config factory. | |
RouteProcessor:: |
protected | property | The entity type manager service. | |
RouteProcessor:: |
public | function |
Processes the outbound route. Overrides OutboundRouteProcessorInterface:: |
|
RouteProcessor:: |
public | function | Constructs a RouteProcessor object. |