public function RouteEnhancerCollectorTrait::addRouteEnhancer in Page Manager 8
Same name and namespace in other branches
- 8.4 src/Routing/RouteEnhancerCollectorTrait.php \Drupal\page_manager\Routing\RouteEnhancerCollectorTrait::addRouteEnhancer()
Add route enhancers to the router to let them generate information on matched routes.
The order of the enhancers is determined by the priority, the higher the value, the earlier the enhancer is run.
Parameters
\Symfony\Cmf\Component\Routing\Enhancer\RouteEnhancerInterface $enhancer:
int $priority:
Return value
$this
File
- src/
Routing/ RouteEnhancerCollectorTrait.php, line 43 - Contains \Drupal\page_manager\Routing\RouteEnhancerCollectorTrait.
Class
- RouteEnhancerCollectorTrait
- Provides a trait to make a service a collector of route enhancers.
Namespace
Drupal\page_manager\RoutingCode
public function addRouteEnhancer(RouteEnhancerInterface $enhancer, $priority = 0) {
if (empty($this->enhancers[$priority])) {
$this->enhancers[$priority] = array();
}
$this->enhancers[$priority][] = $enhancer;
$this->sortedEnhancers = array();
return $this;
}