Version 1
[yaffs-website] / web / modules / contrib / devel / src / Plugin / Menu / DestinationMenuLink.php
1 <?php
2
3 namespace Drupal\devel\Plugin\Menu;
4
5 use Drupal\Core\Menu\MenuLinkDefault;
6 use Drupal\Core\Url;
7
8 /**
9  * Modifies the menu link to add destination.
10  */
11 class DestinationMenuLink extends MenuLinkDefault {
12
13   /**
14    * {@inheritdoc}
15    */
16   public function getOptions() {
17     $options = parent::getOptions();
18     // Append the current path as destination to the query string.
19     $options['query']['destination'] = Url::fromRoute('<current>')->toString();
20     return $options;
21   }
22
23   /**
24    * {@inheritdoc}
25    *
26    * @todo Make cacheable once https://www.drupal.org/node/2582797 lands.
27    */
28   public function getCacheMaxAge() {
29     return 0;
30   }
31
32 }