You are here

protected function GroupContentRouteProvider::getCreateFormRoute in Group 8

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

Gets the create-form 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::getCreateFormRoute()
GroupContentRouteProvider::getRoutes in src/Entity/Routing/GroupContentRouteProvider.php
Provides routes for entities.

File

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

Class

GroupContentRouteProvider
Provides routes for group content.

Namespace

Drupal\group\Entity\Routing

Code

protected function getCreateFormRoute(EntityTypeInterface $entity_type) {
  if ($entity_type
    ->hasLinkTemplate('create-form')) {
    $route = new Route($entity_type
      ->getLinkTemplate('create-form'));
    $route
      ->setDefaults([
      '_controller' => '\\Drupal\\group\\Entity\\Controller\\GroupContentController::createForm',
      // @todo Let forms set title?
      '_title_callback' => '\\Drupal\\group\\Entity\\Controller\\GroupContentController::createFormTitle',
    ])
      ->setRequirement('_group_content_create_entity_access', 'TRUE')
      ->setOption('_group_operation_route', TRUE);
    return $route;
  }
}