class AlertCommand

AJAX command for a javascript alert box.

Hierarchy

Expanded class hierarchy of AlertCommand

4 files declare their use of AlertCommand
AjaxCommandsUnitTest.php in drupal/core/modules/system/lib/Drupal/system/Tests/Ajax/AjaxCommandsUnitTest.php
Definition of Drupal\system\Tests\Ajax\AjaxCommandsUnitTest.
ajax_test.module in drupal/core/modules/system/tests/modules/ajax_test/ajax_test.module
Helper module for Ajax framework tests.
CommandsTest.php in drupal/core/modules/system/lib/Drupal/system/Tests/Ajax/CommandsTest.php
Contains \Drupal\system\Tests\Ajax\CommandsTest.
FrameworkTest.php in drupal/core/modules/system/lib/Drupal/system/Tests/Ajax/FrameworkTest.php
Contains \Drupal\system\Tests\Ajax\FrameworkTest.

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

Namesort descending Modifiers Type Description Overrides
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.