class RouteSubscriber in Contact Emails 8
Subscribe to the Route to change page titles.
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\contact_emails\Routing\RouteSubscriber
Expanded class hierarchy of RouteSubscriber
1 string reference to 'RouteSubscriber'
1 service uses RouteSubscriber
File
- src/
Routing/ RouteSubscriber.php, line 11
Namespace
Drupal\contact_emails\RoutingView source
class RouteSubscriber extends RouteSubscriberBase {
/**
* {@inheritdoc}
*/
public function alterRoutes(RouteCollection $collection) {
// Create new contact email form.
if ($route = $collection
->get('entity.contact_email.add_form')) {
$route
->setDefault('_title_callback', '\\Drupal\\contact_emails\\Routing\\RouteCallback::addFormTitle');
}
// Edit contact emailform.
if ($route = $collection
->get('entity.contact_email.edit_form')) {
$route
->setDefault('_title_callback', '\\Drupal\\contact_emails\\Routing\\RouteCallback::editFormTitle');
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RouteSubscriber:: |
public | function |
Alters existing routes for a specific collection. Overrides RouteSubscriberBase:: |
|
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 |