class GroupRouteProvider in Group 8
Same name and namespace in other branches
- 2.0.x src/Entity/Routing/GroupRouteProvider.php \Drupal\group\Entity\Routing\GroupRouteProvider
Provides routes for groups.
Hierarchy
- class \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider implements EntityHandlerInterface, EntityRouteProviderInterface
- class \Drupal\group\Entity\Routing\GroupRouteProvider
Expanded class hierarchy of GroupRouteProvider
File
- src/
Entity/ Routing/ GroupRouteProvider.php, line 11
Namespace
Drupal\group\Entity\RoutingView source
class GroupRouteProvider extends DefaultHtmlRouteProvider {
/**
* {@inheritdoc}
*/
protected function getAddPageRoute(EntityTypeInterface $entity_type) {
if ($route = parent::getAddPageRoute($entity_type)) {
$route
->setOption('_group_operation_route', TRUE);
return $route;
}
}
/**
* {@inheritdoc}
*/
protected function getAddFormRoute(EntityTypeInterface $entity_type) {
if ($route = parent::getAddFormRoute($entity_type)) {
$route
->setOption('_group_operation_route', TRUE);
$route
->setDefault('_controller', '\\Drupal\\group\\Entity\\Controller\\GroupController::addForm');
$route
->setDefault('_title_callback', '\\Drupal\\group\\Entity\\Controller\\GroupController::addFormTitle');
return $route;
}
}
/**
* {@inheritdoc}
*/
protected function getEditFormRoute(EntityTypeInterface $entity_type) {
if ($route = parent::getEditFormRoute($entity_type)) {
$route
->setOption('_group_operation_route', TRUE);
return $route;
}
}
/**
* {@inheritdoc}
*/
protected function getDeleteFormRoute(EntityTypeInterface $entity_type) {
if ($route = parent::getDeleteFormRoute($entity_type)) {
$route
->setOption('_group_operation_route', TRUE);
return $route;
}
}
/**
* {@inheritdoc}
*/
protected function getCollectionRoute(EntityTypeInterface $entity_type) {
// @todo Remove this method when https://www.drupal.org/node/2767025 lands.
if ($route = parent::getCollectionRoute($entity_type)) {
$route
->setDefault('_title', 'Groups');
$route
->setDefault('_title_arguments', []);
$route
->setRequirement('_permission', 'access group overview');
return $route;
}
}
}