TemplateEditorCustomAction.php in Maestro 3.x
File
src/Plugin/Menu/LocalAction/TemplateEditorCustomAction.php
View source
<?php
namespace Drupal\maestro\Plugin\Menu\LocalAction;
use Drupal\Core\Menu\LocalActionDefault;
use Drupal\Core\Routing\RouteMatchInterface;
class TemplateEditorCustomAction extends LocalActionDefault {
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;
}
}