You are here

protected function ContentRoute::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

2 calls to ContentRoute::buildParameterMap()
ContentRoute::buildRoute in src/Plugin/DMU/Routing/ContentRoute.php
Builds the Drupal 8 route, making any needed changes to the original module and/or callback.
FormRoute::buildParameterMap in src/Plugin/DMU/Routing/FormRoute.php
Builds a parameter map from the aggregated arguments of the title, access, and page callbacks.
1 method overrides ContentRoute::buildParameterMap()
FormRoute::buildParameterMap in src/Plugin/DMU/Routing/FormRoute.php
Builds a parameter map from the aggregated arguments of the title, access, and page callbacks.

File

src/Plugin/DMU/Routing/ContentRoute.php, line 92

Class

ContentRoute
Plugin annotation @Converter( id = "default", description = @Translation("Converts a menu item to a _controller route."), dependencies = { "router.route_provider", "plugin.manager.drupalmoduleupgrader.rewriter" } )

Namespace

Drupal\drupalmoduleupgrader\Plugin\DMU\Routing

Code

protected function buildParameterMap(TargetInterface $target, Drupal7Route $route) {
  $map = new ParameterMap(clone $route
    ->getPath(), []);
  $indexer = $target
    ->getIndexer('function');
  if ($indexer
    ->has($route['title callback'])) {
    $map
      ->merge(new ParameterMap($route
      ->getPath(), $indexer
      ->get($route['title callback'])
      ->getParameters()
      ->toArray(), $route['title arguments']));
  }
  if ($indexer
    ->has($route['access callback'])) {
    $map
      ->merge(new ParameterMap($route
      ->getPath(), $indexer
      ->get($route['access callback'])
      ->getParameters()
      ->toArray(), $route['access arguments']));
  }
  if ($indexer
    ->has($route['page callback'])) {
    $map
      ->merge(new ParameterMap($route
      ->getPath(), $indexer
      ->get($route['page callback'])
      ->getParameters()
      ->toArray(), $route['page arguments']));
  }
  return $map;
}