class JsRedirectCommand in JS Callback Handler 8.3
Defines an AJAX command to set the window.location, loading that URL.
Hierarchy
- class \Drupal\js\Ajax\JsRedirectCommand implements CommandInterface
Expanded class hierarchy of JsRedirectCommand
File
- src/
Ajax/ JsRedirectCommand.php, line 12
Namespace
Drupal\js\AjaxView source
class JsRedirectCommand implements CommandInterface {
/**
* Flag indicating whether redirection should be forced in the browser.
*
* @var bool
*/
protected $force;
/**
* 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 in the browser. This should be a full URL.
* @param bool $force
* Flag indicating whether redirection should be forced in the browser.
*/
public function __construct($url, $force = FALSE) {
$this->url = $url;
$this->force = $force;
}
/**
* Implements \Drupal\Core\Ajax\CommandInterface:render().
*/
public function render() {
return array(
'command' => 'redirect',
'force' => $this->force,
'url' => $this->url,
);
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
JsRedirectCommand:: |
protected | property | Flag indicating whether redirection should be forced in the browser. | |
JsRedirectCommand:: |
protected | property | The URL that will be loaded into window.location. | |
JsRedirectCommand:: |
public | function |
Implements \Drupal\Core\Ajax\CommandInterface:render(). Overrides CommandInterface:: |
|
JsRedirectCommand:: |
public | function | Constructs an RedirectCommand object. |