You are here

public function TemplateEditorCustomAction::getRouteParameters in Maestro 8.2

Same name and namespace in other branches
  1. 3.x src/Plugin/Menu/LocalAction/TemplateEditorCustomAction.php \Drupal\maestro\Plugin\Menu\LocalAction\TemplateEditorCustomAction::getRouteParameters()

Returns the route parameters needed to render a link for the local action.

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: The current route match.

Return value

array An array of parameter names and values.

Overrides LocalActionDefault::getRouteParameters

File

src/Plugin/Menu/LocalAction/TemplateEditorCustomAction.php, line 16

Class

TemplateEditorCustomAction
Defines a local action plugin with a dynamic title.

Namespace

Drupal\maestro\Plugin\Menu\LocalAction

Code

public function getRouteParameters(RouteMatchInterface $route_match) {
  $template = $route_match
    ->getParameter('maestro_template');
  $parameters = [
    'templateMachineName' => 'new',
  ];
  if ($template) {
    $parameters = parent::getRouteParameters($route_match);
    $parameters['templateMachineName'] = $template->id;
  }
  return $parameters;
}