public function RouteSubscriber::alterRoutes in Contact Emails 8
Alters existing routes for a specific collection.
Parameters
\Symfony\Component\Routing\RouteCollection $collection: The route collection for adding routes.
Overrides RouteSubscriberBase::alterRoutes
File
- src/
Routing/ RouteSubscriber.php, line 16
Class
- RouteSubscriber
- Subscribe to the Route to change page titles.
Namespace
Drupal\contact_emails\RoutingCode
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');
}
}