function OpenModalDialogWithUrl::render

Same name in other branches
  1. 10 core/lib/Drupal/Core/Ajax/OpenModalDialogWithUrl.php \Drupal\Core\Ajax\OpenModalDialogWithUrl::render()

Overrides CommandInterface::render

File

core/lib/Drupal/Core/Ajax/OpenModalDialogWithUrl.php, line 37

Class

OpenModalDialogWithUrl
Provides an AJAX command for opening a modal with URL.

Namespace

Drupal\Core\Ajax

Code

public function render() {
    // @see \Drupal\Core\Routing\LocalAwareRedirectResponseTrait::isLocal()
    if (!UrlHelper::isExternal($this->url) || UrlHelper::externalIsLocal($this->url, $this->getBaseURL())) {
        return [
            'command' => 'openModalDialogWithUrl',
            'url' => $this->url,
            'dialogOptions' => $this->settings,
        ];
    }
    throw new \LogicException('External URLs are not allowed.');
}

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