You are here

public function ViewPageController::getTitle in Drupal 10

Same name and namespace in other branches
  1. 9 core/modules/views/src/Routing/ViewPageController.php \Drupal\views\Routing\ViewPageController::getTitle()

Gets the title of the given view's display.

Parameters

string $view_id: The id of the view.

string $display_id: The id of the display from the view.

Return value

string|\Drupal\Component\Render\MarkupInterface The title of the display of the view.

File

core/modules/views/src/Routing/ViewPageController.php, line 80

Class

ViewPageController
Defines a page controller to execute and render a view.

Namespace

Drupal\views\Routing

Code

public function getTitle($view_id, $display_id = 'default') {
  $view = Views::getView($view_id);
  $view
    ->setDisplay($display_id);
  return ViewsRenderPipelineMarkup::create(Xss::filter($view
    ->getTitle()));
}