/** * Gets the Url object associated with the display handler. * * @param string $display_id * (Optional) The display id. ( Used only to detail an exception. ) * * @throws \InvalidArgumentException * Thrown when the display plugin does not have a URL to return. * * @return \Drupal\Core\Url * The display handlers URL object. */ 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(); }
/** * Gets the Url object associated with the display handler. * * @param string $display_id * (Optional) The display id. ( Used only to detail an exception. ) * * @throws \InvalidArgumentException * Thrown when the display plugin does not have a URL to return. * * @return \Drupal\Core\Url * The display handlers URL object. */ public function getUrlInfo($display_id = '') { $this->initDisplay(); if (!$this->display_handler instanceof DisplayRouterInterface) { throw new \InvalidArgumentException(String::format('You cannot generate a URL for the display @display_id', ['@display_id' => $display_id])); } return $this->display_handler->getUrlInfo(); }