You are here

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

Generates the route's machine-readable name.

Return value

string

Overrides ContentRoute::getName

File

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

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

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