You are here

WebformConfirmReloadCommand.php in Webform 6.x

Same filename and directory in other branches
  1. 8.5 src/Ajax/WebformConfirmReloadCommand.php

File

src/Ajax/WebformConfirmReloadCommand.php
View source
<?php

namespace Drupal\webform\Ajax;

use Drupal\Core\Ajax\CommandInterface;

/**
 * Provides an Ajax command for confirming page reload.
 *
 * This command is implemented in Drupal.AjaxCommands.prototype.webformConfirmReload.
 */
class WebformConfirmReloadCommand implements CommandInterface {

  /**
   * The message to be displayed.
   *
   * @var string
   */
  protected $message;

  /**
   * Constructs a WebformConfirmReloadCommand object.
   *
   * @param string $message
   *   The message to be displayed.
   */
  public function __construct($message) {
    $this->message = $message;
  }

  /**
   * Implements \Drupal\Core\Ajax\CommandInterface:render().
   */
  public function render() {
    return [
      'command' => 'webformConfirmReload',
      'message' => $this->message,
    ];
  }

}

Classes

Namesort descending Description
WebformConfirmReloadCommand Provides an Ajax command for confirming page reload.