You are here

protected function GroupContentRouteProvider::getCreatePageRoute in Group 2.0.x

Same name and namespace in other branches
  1. 8 src/Entity/Routing/GroupContentRouteProvider.php \Drupal\group\Entity\Routing\GroupContentRouteProvider::getCreatePageRoute()

Gets the create-page route.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type.

Return value

\Symfony\Component\Routing\Route|null The generated route, if available.

1 call to GroupContentRouteProvider::getCreatePageRoute()
GroupContentRouteProvider::getRoutes in src/Entity/Routing/GroupContentRouteProvider.php
Provides routes for entities.

File

src/Entity/Routing/GroupContentRouteProvider.php, line 75

Class

GroupContentRouteProvider
Provides routes for group content.

Namespace

Drupal\group\Entity\Routing

Code

protected function getCreatePageRoute(EntityTypeInterface $entity_type) {
  if ($entity_type
    ->hasLinkTemplate('create-page') && $entity_type
    ->getKey('bundle')) {
    $route = new Route($entity_type
      ->getLinkTemplate('create-page'));
    $route
      ->setDefault('_controller', '\\Drupal\\group\\Entity\\Controller\\GroupContentController::addPage')
      ->setDefault('_title', 'Add new content')
      ->setDefault('create_mode', TRUE)
      ->setRequirement('_group_content_create_any_entity_access', 'TRUE')
      ->setOption('_group_operation_route', TRUE);
    return $route;
  }
}