class RouteSubscriber in Menu Link Clone 8.2
Same name and namespace in other branches
- 8.3 src/Routing/RouteSubscriber.php \Drupal\menu_link_clone\Routing\RouteSubscriber
- 8 src/Routing/RouteSubscriber.php \Drupal\menu_link_clone\Routing\RouteSubscriber
Listens to the dynamic route events.
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\menu_link_clone\Routing\RouteSubscriber
Expanded class hierarchy of RouteSubscriber
1 string reference to 'RouteSubscriber'
1 service uses RouteSubscriber
File
- src/
Routing/ RouteSubscriber.php, line 12
Namespace
Drupal\menu_link_clone\RoutingView source
class RouteSubscriber extends RouteSubscriberBase {
/**
* The entity type manager service.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Constructs a new RouteSubscriber object.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_manager
* The entity type manager.
*/
public function __construct(EntityTypeManagerInterface $entity_manager) {
$this->entityTypeManager = $entity_manager;
}
/**
* {@inheritdoc}
*/
protected function alterRoutes(RouteCollection $collection) {
$menu = $this->entityTypeManager
->getDefinition('menu')
->id();
if ($menu) {
if ($route = $collection
->get("entity.{$menu}.clone_form")) {
$route
->setDefault('_form', '\\Drupal\\menu_link_clone\\Form\\EntityMenuLinkCloneForm');
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RouteSubscriber:: |
protected | property | The entity type manager service. | |
RouteSubscriber:: |
protected | function |
Alters existing routes for a specific collection. Overrides RouteSubscriberBase:: |
|
RouteSubscriber:: |
public | function | Constructs a new RouteSubscriber object. | |
RouteSubscriberBase:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | 5 |
RouteSubscriberBase:: |
public | function | Delegates the route altering to self::alterRoutes(). | 1 |