You are here

protected function GroupContentMenuRouteProvider::getAddFormRoute in Group Content Menu 8

Gets the add-form route.

Parameters

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

Return value

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

Overrides DefaultHtmlRouteProvider::getAddFormRoute

File

src/Routing/GroupContentMenuRouteProvider.php, line 106

Class

GroupContentMenuRouteProvider
Provides routes for group_content_menu content.

Namespace

Drupal\group_content_menu\Routing

Code

protected function getAddFormRoute(EntityTypeInterface $entity_type) {
  if ($route = parent::getAddFormRoute($entity_type)) {
    $requirements = $route
      ->getRequirements();
    unset($requirements['_entity_create_access']);
    $route
      ->setRequirements($requirements);
    return $route
      ->setDefault('_title', 'Add new menu')
      ->setDefault('_controller', sprintf('%s::createForm', GroupContentMenuController::class))
      ->setRequirement('_group_permission', 'manage group_content_menu')
      ->setRequirement('_group_installed_content', implode('+', $this
      ->getPluginIds()))
      ->setOption('_group_operation_route', TRUE);
  }
}