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

Namespace

Drupal\Core\Ajax

File

core/lib/Drupal/Core/Ajax/RedirectCommand.php
View source
<?php

namespace Drupal\Core\Ajax;


/**
 * Defines an AJAX command to set the window.location, loading that URL.
 *
 * @ingroup ajax
 */
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,
    ];
  }

}

Classes

Namesort descending Description
RedirectCommand Defines an AJAX command to set the window.location, loading that URL.