"Fossies" - the Fresh Open Source Software Archive

Member "drupal-8.9.9/core/lib/Drupal/Core/Ajax/RedirectCommand.php" (18 Nov 2020, 726 Bytes) of package /linux/www/drupal-8.9.9.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "RedirectCommand.php" see the Fossies "Dox" file reference documentation.

    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 }