class SetBrowserUrl

AJAX command that sets the browser URL without refreshing the page.

This command is implemented in Drupal.AjaxCommands.prototype.setBrowserUrl.

Hierarchy

Expanded class hierarchy of SetBrowserUrl

1 file declares its use of SetBrowserUrl
ViewAjaxController.php in core/modules/views/src/Controller/ViewAjaxController.php
1 string reference to 'SetBrowserUrl'
SetBrowserUrl::render in core/modules/views/src/Ajax/SetBrowserUrl.php
Return an array to be run through json_encode and sent to the client.

File

core/modules/views/src/Ajax/SetBrowserUrl.php, line 12

Namespace

Drupal\views\Ajax
View source
class SetBrowserUrl implements CommandInterface {
  
  /**
   * Constructs a new command instance.
   *
   * @param string $url
   *   The URL to be set in the browser.
   */
  public function __construct(protected string $url) {
  }
  
  /**
   * {@inheritdoc}
   */
  public function render() : array {
    return [
      'command' => 'setBrowserUrl',
      'url' => $this->url,
    ];
  }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
SetBrowserUrl::render public function Return an array to be run through json_encode and sent to the client. Overrides CommandInterface::render
SetBrowserUrl::__construct public function Constructs a new command instance.

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