You are here

protected function FormModesSubscriber::getFormModeRouteDefaults in Form mode manager 8

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

Get defaults parameters nedeed to build Form Mode Manager routes.

Parameters

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

array $form_mode: 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
Set Form Mode Manager routes based on parent entity routes.

File

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

Class

FormModesSubscriber
Subscriber for form_mode_manager routes.

Namespace

Drupal\form_mode_manager\Routing\EventSubscriber

Code

protected function getFormModeRouteDefaults(Route $route, array $form_mode) {
  $route_parameters = [
    '_entity_form' => $form_mode['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;
}