class AllowedLanguagesRouteSubscriber in Allowed Languages 8
Same name and namespace in other branches
- 2.x src/Routing/AllowedLanguagesRouteSubscriber.php \Drupal\allowed_languages\Routing\AllowedLanguagesRouteSubscriber
Subscriber for entity translation routes.
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\content_translation\Routing\ContentTranslationRouteSubscriber
- class \Drupal\allowed_languages\Routing\AllowedLanguagesRouteSubscriber
- class \Drupal\content_translation\Routing\ContentTranslationRouteSubscriber
Expanded class hierarchy of AllowedLanguagesRouteSubscriber
1 string reference to 'AllowedLanguagesRouteSubscriber'
1 service uses AllowedLanguagesRouteSubscriber
File
- src/
Routing/ AllowedLanguagesRouteSubscriber.php, line 12
Namespace
Drupal\allowed_languages\RoutingView source
class AllowedLanguagesRouteSubscriber extends ContentTranslationRouteSubscriber {
/**
* {@inheritdoc}
*/
protected function alterRoutes(RouteCollection $collection) {
foreach ($this->contentTranslationManager
->getSupportedEntityTypes() as $entity_type_id => $entity_type) {
if ($route = $collection
->get("entity.{$entity_type_id}.content_translation_overview")) {
$route
->setDefault('_controller', '\\Drupal\\allowed_languages\\Controller\\AllowedLanguagesController::overview');
}
}
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
// Should run after ContentTranslationRouteSubscriber. Therefore priority -220.
$events[RoutingEvents::ALTER] = [
'onAlterRoutes',
-220,
];
return $events;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AllowedLanguagesRouteSubscriber:: |
protected | function |
Alters existing routes for a specific collection. Overrides ContentTranslationRouteSubscriber:: |
|
AllowedLanguagesRouteSubscriber:: |
public static | function |
Returns an array of event names this subscriber wants to listen to. Overrides ContentTranslationRouteSubscriber:: |
|
ContentTranslationRouteSubscriber:: |
protected | property | The content translation manager. | |
ContentTranslationRouteSubscriber:: |
public | function | Constructs a ContentTranslationRouteSubscriber object. | |
RouteSubscriberBase:: |
public | function | Delegates the route altering to self::alterRoutes(). | 1 |