class RngRouteEnhancer in RNG - Events and Registrations 8.2
Same name and namespace in other branches
- 8 src/Routing/Enhancer/RngRouteEnhancer.php \Drupal\rng\Routing\Enhancer\RngRouteEnhancer
- 3.x src/Routing/Enhancer/RngRouteEnhancer.php \Drupal\rng\Routing\Enhancer\RngRouteEnhancer
Route enhancer for RNG.
Hierarchy
- class \Drupal\rng\Routing\Enhancer\RngRouteEnhancer implements RouteEnhancerInterface
Expanded class hierarchy of RngRouteEnhancer
1 string reference to 'RngRouteEnhancer'
1 service uses RngRouteEnhancer
File
- src/
Routing/ Enhancer/ RngRouteEnhancer.php, line 12
Namespace
Drupal\rng\Routing\EnhancerView source
class RngRouteEnhancer implements RouteEnhancerInterface {
/**
* {@inheritdoc}
*/
public function applies(Route $route) {
return $route
->hasRequirement('_entity_is_event') && $route
->hasDefault('event');
}
/**
* {@inheritdoc}
*/
public function enhance(array $defaults, Request $request) {
if (!empty($defaults['event'])) {
$event_entity_type = $defaults['event'];
if (isset($defaults[$event_entity_type])) {
$rng_event = $defaults[$event_entity_type];
$defaults['rng_event'] = $rng_event;
}
}
return $defaults;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RngRouteEnhancer:: |
public | function |
Declares if the route enhancer applies to the given route. Overrides RouteEnhancerInterface:: |
|
RngRouteEnhancer:: |
public | function | Update the defaults based on its own data and the request. |