public function FormModesSubscriber::setAddPageCollection 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::setAddPageCollection()
Set one add_page route per form_mode for compatible entities.
@todo Make this configurable.
Parameters
\Symfony\Component\Routing\RouteCollection $collection: The route collection to retrieve parent entity routes.
\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type definition.
array $form_mode: A form-mode for specified entity_type_id.
1 call to FormModesSubscriber::setAddPageCollection()
- FormModesSubscriber::addFormModesRoutes in src/
Routing/ EventSubscriber/ FormModesSubscriber.php - Generate all operations routes for entities.
File
- src/
Routing/ EventSubscriber/ FormModesSubscriber.php, line 148
Class
- FormModesSubscriber
- Subscriber for form_mode_manager routes.
Namespace
Drupal\form_mode_manager\Routing\EventSubscriberCode
public function setAddPageCollection(RouteCollection $collection, EntityTypeInterface $entity_type, array $form_mode) {
$form_mode_name = $this->formModeManager
->getFormModeMachineName($form_mode['id']);
if ($route = $this
->getFormModeListPageRoute($entity_type, $form_mode)) {
$collection
->add("form_mode_manager.{$entity_type->id()}.add_page.{$form_mode_name}", $route);
}
}