1. 8.5.x core/lib/Drupal/Core/Ajax/RedirectCommand.php RedirectCommand
  2. 8.0.x core/lib/Drupal/Core/Ajax/RedirectCommand.php RedirectCommand
  3. 8.1.x core/lib/Drupal/Core/Ajax/RedirectCommand.php RedirectCommand
  4. 8.2.x core/lib/Drupal/Core/Ajax/RedirectCommand.php RedirectCommand
  5. 8.3.x core/lib/Drupal/Core/Ajax/RedirectCommand.php RedirectCommand
  6. 8.4.x core/lib/Drupal/Core/Ajax/RedirectCommand.php RedirectCommand
  7. 8.6.x core/lib/Drupal/Core/Ajax/RedirectCommand.php RedirectCommand

Defines an AJAX command to set the window.location, loading that URL.

Hierarchy

Expanded class hierarchy of RedirectCommand

Related topics

2 files declare their use of RedirectCommand
AjaxCommandsTest.php in core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php
BlockEntityOffCanvasForm.php in core/modules/settings_tray/src/Block/BlockEntityOffCanvasForm.php

File

core/lib/Drupal/Core/Ajax/RedirectCommand.php, line 10

Namespace

Drupal\Core\Ajax
View source
class RedirectCommand implements CommandInterface {

  /**
   * The URL that will be loaded into window.location.
   *
   * @var string
   */
  protected $url;

  /**
   * Constructs an RedirectCommand object.
   *
   * @param string $url
   *   The URL that will be loaded into window.location. This should be a full
   *   URL.
   */
  public function __construct($url) {
    $this->url = $url;
  }

  /**
   * Implements \Drupal\Core\Ajax\CommandInterface:render().
   */
  public function render() {
    return [
      'command' => 'redirect',
      'url' => $this->url,
    ];
  }

}

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description Overrides
RedirectCommand::$url protected property The URL that will be loaded into window.location.
RedirectCommand::render public function Implements \Drupal\Core\Ajax\CommandInterface:render(). Overrides CommandInterface::render
RedirectCommand::__construct public function Constructs an RedirectCommand object.