Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function getOptions(RouteMatchInterface $route_match)
 {
     $options = parent::getOptions($route_match);
     // Append the current path as destination to the query string.
     $options['query']['destination'] = $this->redirectDestination->get();
     return $options;
 }
 /**
  * Tests the getTitle method with title arguments.
  */
 public function testGetTitleWithTitleArguments()
 {
     $this->pluginDefinition['title'] = new TranslatableMarkup('Example @test', array('@test' => 'value'), [], $this->stringTranslation);
     $this->stringTranslation->expects($this->once())->method('translateString')->with($this->pluginDefinition['title'])->will($this->returnValue('Example value'));
     $this->setupLocalActionDefault();
     $request = new Request();
     $this->assertEquals('Example value', $this->localActionDefault->getTitle($request));
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function getOptions(RouteMatchInterface $route_match)
 {
     $options = parent::getOptions($route_match);
     // If the route specifies a theme, append it to the query string.
     if ($theme = $route_match->getParameter('theme')) {
         $options['query']['theme'] = $theme;
     }
     // Adds a destination on custom block listing.
     if ($route_match->getRouteName() == 'entity.block_content.collection') {
         $options['query']['destination'] = $this->url('<current>');
     }
     return $options;
 }
Ejemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function getOptions(Request $request)
 {
     $options = parent::getOptions($request);
     // Append the current path as destination to the query string.
     if ($request->attributes->has(RouteObjectInterface::ROUTE_NAME)) {
         $route_name = $request->attributes->get(RouteObjectInterface::ROUTE_NAME);
         $raw_variables = array();
         if ($request->attributes->has('_raw_variables')) {
             $raw_variables = $request->attributes->get('_raw_variables')->all();
         }
         // @todo Use RouteMatch instead of Request.
         //   https://www.drupal.org/node/2294157
         $options['query']['destination'] = \Drupal::urlGenerator()->generateFromRoute($route_name, $raw_variables);
     }
     return $options;
 }
 /**
  * {@inheritdoc}
  */
 public function getOptions(Request $request)
 {
     $options = parent::getOptions($request);
     // If the route specifies a theme, append it to the query string.
     if ($request->attributes->has('theme')) {
         $options['query']['theme'] = $request->attributes->get('theme');
     }
     // Adds a destination on custom block listing.
     if ($request->attributes->get(RouteObjectInterface::ROUTE_NAME) == 'block_content.list') {
         $options['query']['destination'] = 'admin/structure/block/block-content';
     }
     // Adds a destination on custom block listing.
     if ($request->attributes->get(RouteObjectInterface::ROUTE_NAME) == 'block_content.list') {
         $options['query']['destination'] = 'admin/structure/block/block-content';
     }
     return $options;
 }
 /**
  * Constructs a TestLocalActionWithConfig object.
  *
  * @param array $configuration
  *   A configuration array containing information about the plugin instance.
  * @param string $plugin_id
  *   The plugin_id for the plugin instance.
  * @param mixed $plugin_definition
  *   The plugin implementation definition.
  * @param \Drupal\Core\Routing\RouteProviderInterface $route_provider
  *   The route provider to load routes by name.
  * @param \Drupal\Core\Config\Config $config
  *   The 'menu_test.links.action' config.
  */
 public function __construct(array $configuration, $plugin_id, $plugin_definition, RouteProviderInterface $route_provider, Config $config)
 {
     parent::__construct($configuration, $plugin_id, $plugin_definition, $route_provider);
     $this->config = $config;
 }
Ejemplo n.º 7
0
 /**
  * Constructs a LocalActionDefault object.
  *
  * @param array $configuration
  *   A configuration array containing information about the plugin instance.
  * @param string $plugin_id
  *   The plugin_id for the plugin instance.
  * @param mixed $plugin_definition
  *   The plugin implementation definition.
  * @param \Drupal\Core\Routing\RouteProviderInterface $route_provider
  *   The route provider to load routes by name.
  * @param \Drupal\rng\EventManagerInterface $event_manager
  *   The RNG event manager.
  * @param \Drupal\Core\Routing\RouteMatchInterface $current_route
  *   The current route matcher.
  */
 public function __construct(array $configuration, $plugin_id, $plugin_definition, RouteProviderInterface $route_provider, EventManagerInterface $event_manager, RouteMatchInterface $current_route)
 {
     parent::__construct($configuration, $plugin_id, $plugin_definition, $route_provider);
     $this->eventManager = $event_manager;
     $this->currentRoute = $current_route;
 }