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

File

drupal/core/lib/Drupal/Core/Ajax/AlertCommand.php, line 15
Definition of Drupal\Core\Ajax\AlertCommand.

Namespace

Drupal\Core\Ajax
View 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 array(
      'command' => 'alert',
      'text' => $this->text,
    );
  }

}

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description
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.