You are here

protected function GroupContentRouteProvider::getAddPageRoute in Group 2.0.x

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

Gets the add page route.

Built only for entity types that have bundles.

Parameters

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

Return value

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

Overrides DefaultHtmlRouteProvider::getAddPageRoute

File

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

Class

GroupContentRouteProvider
Provides routes for group content.

Namespace

Drupal\group\Entity\Routing

Code

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