LocalActionWithDestination.php
Namespace
Drupal\Core\MenuFile
-
core/
lib/ Drupal/ Core/ Menu/ LocalActionWithDestination.php
View source
<?php
namespace Drupal\Core\Menu;
use Drupal\Core\Routing\RedirectDestinationInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Routing\RouteProviderInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Modifies the local action to add a destination.
*/
class LocalActionWithDestination extends LocalActionDefault {
public function __construct(array $configuration, $plugin_id, $plugin_definition, RouteProviderInterface $route_provider, RedirectDestinationInterface $redirectDestination) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $route_provider);
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container->get('router.route_provider'), $container->get('redirect.destination'));
}
/**
* {@inheritdoc}
*/
public function getOptions(RouteMatchInterface $route_match) {
$options = parent::getOptions($route_match);
// Append the current path or destination to the query string.
$options['query']['destination'] = $this->redirectDestination
->get();
return $options;
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
LocalActionWithDestination | Modifies the local action to add a destination. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.