You are here

RouteDetailMenuLink.php in Devel 4.x

File

src/Plugin/Menu/RouteDetailMenuLink.php
View source
<?php

namespace Drupal\devel\Plugin\Menu;

use Drupal\Core\Menu\MenuLinkDefault;
use Drupal\Core\Url;

/**
 * Modifies the menu link to add current route path.
 */
class RouteDetailMenuLink extends MenuLinkDefault {

  /**
   * {@inheritdoc}
   */
  public function getOptions() {
    $options = parent::getOptions();
    $options['query']['path'] = '/' . Url::fromRoute('<current>')
      ->getInternalPath();
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheMaxAge() {
    return 0;
  }

}

Classes

Namesort descending Description
RouteDetailMenuLink Modifies the menu link to add current route path.