private function FormModesSubscriber::setRoutes in Form mode manager 8
Same name and namespace in other branches
- 8.2 src/Routing/EventSubscriber/FormModesSubscriber.php \Drupal\form_mode_manager\Routing\EventSubscriber\FormModesSubscriber::setRoutes()
Set Form Mode Manager routes based on parent entity routes.
Parameters
\Symfony\Component\Routing\Route $parent_route: The route object of entity.
\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type definition.
array $form_mode: The form mode info.
Return value
\Symfony\Component\Routing\Route Form Mode Manager route to be added on entity collection.
1 call to FormModesSubscriber::setRoutes()
- FormModesSubscriber::getFormModeRoute in src/
Routing/ EventSubscriber/ FormModesSubscriber.php - Get the Form Mode Manager route for given operation.
File
- src/
Routing/ EventSubscriber/ FormModesSubscriber.php, line 262
Class
- FormModesSubscriber
- Subscriber for form_mode_manager routes.
Namespace
Drupal\form_mode_manager\Routing\EventSubscriberCode
private function setRoutes(Route $parent_route, EntityTypeInterface $entity_type, array $form_mode) {
$route_defaults = NestedArray::mergeDeep($parent_route
->getDefaults(), $this
->getFormModeRouteDefaults($parent_route, $form_mode));
$roue_options = NestedArray::mergeDeep($parent_route
->getOptions(), $this
->getFormModeRouteOptions($form_mode, $entity_type));
$route_requirements = NestedArray::mergeDeep($parent_route
->getRequirements(), $this
->getFormModeRouteRequirements($form_mode));
$route = new Route("{$parent_route->getPath()}/{$this->formModeManager->getFormModeMachineName($form_mode['id'])}");
$route
->addDefaults($route_defaults)
->setOptions($roue_options)
->addRequirements($route_requirements);
return $route;
}