devel_wizard-2.x-dev/templates/spell/entity_type_group/route-subscriber.php.twig
templates/spell/entity_type_group/route-subscriber.php.twig
<?php
declare(strict_types=1);
namespace Drupal\{{ module.machineName }}\Routing;
use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;
class RouteSubscriber extends RouteSubscriberBase {
/**
* {@inheritdoc}
*/
protected function alterRoutes(RouteCollection $collection) {
if ($route = $collection->get('entity.group_relationship.create_page')) {
$copy = clone $route;
$copy->setPath('group/{group}/{{ contentEntityType.id }}/create');
$copy->setDefault('base_plugin_id', '{{ groupRelationPlugin.id }}');
$collection->add('entity.group_relationship.{{ groupRelationPlugin.id }}_create_page', $copy);
}
if ($route = $collection->get('entity.group_relationship.add_page')) {
$copy = clone $route;
$copy->setPath('group/{group}/{{ contentEntityType.id }}/add');
$copy->setDefault('base_plugin_id', '{{ groupRelationPlugin.id }}');
$collection->add('entity.group_relationship.{{ groupRelationPlugin.id }}_add_page', $copy);
}
}
}
