function ViewExecutable::getUrlInfo

Same name in other branches
  1. 9 core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::getUrlInfo()
  2. 8.9.x core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::getUrlInfo()
  3. 11.x core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::getUrlInfo()

Gets the Url object associated with the display handler.

Parameters

string $display_id: (optional) The display ID (used only to detail an exception).

Return value

\Drupal\Core\Url The display handlers URL object.

Throws

\InvalidArgumentException Thrown when the display plugin does not have a URL to return.

File

core/modules/views/src/ViewExecutable.php, line 2057

Class

ViewExecutable
Represents a view as a whole.

Namespace

Drupal\views

Code

public function getUrlInfo($display_id = '') {
    $this->initDisplay();
    if (!$this->display_handler instanceof DisplayRouterInterface) {
        throw new \InvalidArgumentException("You cannot generate a URL for the display '{$display_id}'");
    }
    return $this->display_handler
        ->getUrlInfo();
}

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