You are here

public function ContentRoute::getName in Drupal 7 to 8/9 Module Upgrader 8

Generates the route's machine-readable name.

Return value

string

Overrides RouteConverterInterface::getName

1 call to ContentRoute::getName()
ContentRoute::buildRouteDefinition in src/Plugin/DMU/Routing/ContentRoute.php
Builds the Drupal 8 definition for the route, without making any changes to the original module or callback.
1 method overrides ContentRoute::getName()
FormRoute::getName in src/Plugin/DMU/Routing/FormRoute.php
Generates the route's machine-readable name.

File

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

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

public function getName(TargetInterface $target, Drupal7Route $route) {
  $name = $target
    ->id() . '.' . $this
    ->unPrefix($route['page callback'], $target
    ->id());
  $arguments = array_filter($route['page arguments'], 'is_string');
  if ($arguments) {
    $name .= '_' . implode('_', $arguments);
  }
  return $name;
}