function MenuLinkAdd::getOptions

Same name in other branches
  1. 8.9.x core/modules/menu_ui/src/Plugin/Menu/LocalAction/MenuLinkAdd.php \Drupal\menu_ui\Plugin\Menu\LocalAction\MenuLinkAdd::getOptions()
  2. 10 core/modules/menu_ui/src/Plugin/Menu/LocalAction/MenuLinkAdd.php \Drupal\menu_ui\Plugin\Menu\LocalAction\MenuLinkAdd::getOptions()
  3. 11.x core/modules/menu_ui/src/Plugin/Menu/LocalAction/MenuLinkAdd.php \Drupal\menu_ui\Plugin\Menu\LocalAction\MenuLinkAdd::getOptions()

Overrides LocalActionDefault::getOptions

File

core/modules/menu_ui/src/Plugin/Menu/LocalAction/MenuLinkAdd.php, line 59

Class

MenuLinkAdd
Modifies the 'Add link' local action to add a destination.

Namespace

Drupal\menu_ui\Plugin\Menu\LocalAction

Code

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.