3 namespace Drupal\block_content\Plugin\Menu\LocalAction;
5 use Drupal\Core\Menu\LocalActionDefault;
6 use Drupal\Core\Routing\RouteMatchInterface;
7 use Drupal\Core\Routing\UrlGeneratorTrait;
10 * Modifies the 'Add custom block' local action.
12 class BlockContentAddLocalAction extends LocalActionDefault {
13 use UrlGeneratorTrait;
18 public function getOptions(RouteMatchInterface $route_match) {
19 $options = parent::getOptions($route_match);
20 // If the route specifies a theme, append it to the query string.
21 if ($theme = $route_match->getParameter('theme')) {
22 $options['query']['theme'] = $theme;
24 // Adds a destination on custom block listing.
25 if ($route_match->getRouteName() == 'entity.block_content.collection') {
26 $options['query']['destination'] = $this->url('<current>');