class AlertCommand
AJAX command for a javascript alert box.
Hierarchy
- class \Drupal\Core\Ajax\AlertCommand implements \Drupal\Core\Ajax\CommandInterface
Expanded class hierarchy of AlertCommand
Related topics
- Ajax API
- Overview for Drupal's Ajax API.
1 file declares its use of AlertCommand
- AjaxRenderer.php in core/
lib/ Drupal/ Core/ Render/ MainContent/ AjaxRenderer.php
File
-
core/
lib/ Drupal/ Core/ Ajax/ AlertCommand.php, line 10
Namespace
Drupal\Core\AjaxView source
class AlertCommand implements CommandInterface {
/**
* The text to be displayed in the alert box.
*
* @var string
*/
protected $text;
/**
* Constructs an AlertCommand object.
*
* @param string $text
* The text to be displayed in the alert box.
*/
public function __construct($text) {
$this->text = $text;
}
/**
* Implements Drupal\Core\Ajax\CommandInterface:render().
*/
public function render() {
return [
'command' => 'alert',
'text' => $this->text,
];
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
AlertCommand::$text | protected | property | The text to be displayed in the alert box. | |
AlertCommand::render | public | function | Implements Drupal\Core\Ajax\CommandInterface:render(). | Overrides CommandInterface::render |
AlertCommand::__construct | public | function | Constructs an AlertCommand object. |