You are here

protected function FormRoute::buildParameterMap in Drupal 7 to 8/9 Module Upgrader 8

Builds a parameter map from the aggregated arguments of the title, access, and page callbacks.

Return value

\Drupal\drupalmoduleupgrader\Routing\ParameterMap

Overrides ContentRoute::buildParameterMap

File

src/Plugin/DMU/Routing/FormRoute.php, line 50

Class

FormRoute
Plugin annotation @Converter( id = "drupal_get_form", description = @Translation("Converts a drupal_get_form() menu item to a _form route."), dependencies = { "router.route_provider", "plugin.manager.drupalmoduleupgrader.rewriter",…

Namespace

Drupal\drupalmoduleupgrader\Plugin\DMU\Routing

Code

protected function buildParameterMap(TargetInterface $target, RouteWrapper $route) {
  $map = parent::buildParameterMap($target, $route);
  $indexer = $target
    ->getIndexer('function');
  if ($indexer
    ->has($route['page arguments'][0])) {
    $builder = $indexer
      ->get($route['page arguments'][0]);
    $parameters = $this
      ->bumpKeys(array_slice($builder
      ->getParameters()
      ->toArray(), 2), 2);
    $arguments = $this
      ->bumpKeys(array_slice($route['page arguments'], 1), 2);
    $map
      ->merge(new ParameterMap($route
      ->getPath(), $parameters, $arguments));
  }
  return $map;
}