public static function EntityconnectController::getAddRoute in Entity connect 8.2
Returns the Symfony routes of the given entity's add form.
Parameters
string $entity_type: The target entity type.
Return value
array An array of add page routes for the given entity type.
1 call to EntityconnectController::getAddRoute()
- EntityconnectController::addInfo in src/
Controller/ EntityconnectController.php - Callback for creating the build array of entity types to add.
File
- src/
Controller/ EntityconnectController.php, line 406
Class
- EntityconnectController
- Returns responses for Entityconnect module routes.
Namespace
Drupal\entityconnect\ControllerCode
public static function getAddRoute($entity_type) {
/** @var \Drupal\Core\Routing\RouteProvider $route_provider */
$route_provider = \Drupal::getContainer()
->get('router.route_provider');
$route_name = [];
switch ($entity_type) {
case 'node':
$route_name[] = 'node.add';
break;
case 'user':
$route_name[] = 'user.admin_create';
break;
case 'shortcut':
$route_name[] = 'shortcut.link_add';
break;
default:
// Some default add form route names.
$route_name = [
$entity_type . '.add_form',
'entity.' . $entity_type . '.add_form',
];
}
return $route_provider
->getRoutesByNames($route_name);
}