You are here

public function PathPluginBase::getRouteName in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/display/PathPluginBase.php \Drupal\views\Plugin\views\display\PathPluginBase::getRouteName()

Returns the route name for the display.

The default route name for a display is views.$view_id.$display_id. Some displays may override existing routes; in these cases, the route that is overridden is returned instead.

Return value

string The name of the route

Overrides DisplayRouterInterface::getRouteName

See also

\Drupal\views\Plugin\views\display\DisplayRouterInterface::alterRoutes()

\Drupal\views\Plugin\views\display\DisplayRouterInterface::getAlteredRouteNames()

2 calls to PathPluginBase::getRouteName()
PathPluginBase::getMenuLinks in core/modules/views/src/Plugin/views/display/PathPluginBase.php
Gets menu links, if this display provides some.
PathPluginBase::getUrlInfo in core/modules/views/src/Plugin/views/display/PathPluginBase.php
Generates a URL to this display.

File

core/modules/views/src/Plugin/views/display/PathPluginBase.php, line 544

Class

PathPluginBase
The base display plugin for path/callbacks. This is used for pages and feeds.

Namespace

Drupal\views\Plugin\views\display

Code

public function getRouteName() {
  $view_id = $this->view->storage
    ->id();
  $display_id = $this->display['id'];
  $view_route_key = "{$view_id}.{$display_id}";

  // Check for overridden route names.
  $view_route_names = $this
    ->getAlteredRouteNames();
  return isset($view_route_names[$view_route_key]) ? $view_route_names[$view_route_key] : "view.{$view_route_key}";
}