Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / lib / Drupal / Core / Ajax / RedirectCommand.php
1 <?php
2
3 namespace Drupal\Core\Ajax;
4
5 /**
6  * Defines an AJAX command to set the window.location, loading that URL.
7  *
8  * @ingroup ajax
9  */
10 class RedirectCommand implements CommandInterface {
11
12   /**
13    * The URL that will be loaded into window.location.
14    *
15    * @var string
16    */
17   protected $url;
18
19   /**
20    * Constructs an RedirectCommand object.
21    *
22    * @param string $url
23    *   The URL that will be loaded into window.location. This should be a full
24    *   URL.
25    */
26   public function __construct($url) {
27     $this->url = $url;
28   }
29
30   /**
31    * Implements \Drupal\Core\Ajax\CommandInterface:render().
32    */
33   public function render() {
34     return [
35       'command' => 'redirect',
36       'url' => $this->url,
37     ];
38   }
39
40 }