You are here

protected function FormModesSubscriber::getFormModeRouteDefaults in Form mode manager 8.2

Same name and namespace in other branches
  1. 8 src/Routing/EventSubscriber/FormModesSubscriber.php \Drupal\form_mode_manager\Routing\EventSubscriber\FormModesSubscriber::getFormModeRouteDefaults()

Get defaults parameters needed to build Form Mode Manager routes.

Parameters

\Symfony\Component\Routing\Route $route: The route object of entity.

array $form_mode_infos: The form mode info.

Return value

array Array contain defaults routes parameters.

1 call to FormModesSubscriber::getFormModeRouteDefaults()
FormModesSubscriber::setRoutes in src/Routing/EventSubscriber/FormModesSubscriber.php
Generate a routes based on top of given parent routes.

File

src/Routing/EventSubscriber/FormModesSubscriber.php, line 235

Class

FormModesSubscriber
Listens to the dynamic route event and add routes using form modes.

Namespace

Drupal\form_mode_manager\Routing\EventSubscriber

Code

protected function getFormModeRouteDefaults(Route $route, array $form_mode_infos) {
  $route_parameters = [
    '_entity_form' => $form_mode_infos['id'],
    '_controller' => static::FORM_MODE_DEFAULT_CONTROLLER . '::entityAdd',
    '_title_callback' => static::FORM_MODE_DEFAULT_CONTROLLER . '::addPageTitle',
  ];
  if (static::isEditRoute($route)) {
    $route_parameters['_title_callback'] = static::FORM_MODE_DEFAULT_CONTROLLER . '::editPageTitle';
    $route_parameters['_controller'] = static::FORM_MODE_DEFAULT_CONTROLLER . '::entityEdit';
  }
  return $route_parameters;
}