diff --git a/core/lib/Drupal/Core/Ajax/MessageCommand.php b/core/lib/Drupal/Core/Ajax/MessageCommand.php index 4709257bb1..653041c39b 100644 --- a/core/lib/Drupal/Core/Ajax/MessageCommand.php +++ b/core/lib/Drupal/Core/Ajax/MessageCommand.php @@ -30,34 +30,34 @@ class MessageCommand implements CommandInterface, CommandWithAttachedAssetsInter * * @var string */ - protected $messageWrapperQuerySelector; + protected $wrapperQuerySelector; /** * The options passed to Drupal.message().add(). * * @var array */ - protected $messageOptions; + protected $options; /** * Constructs a MessageCommand object. * * @param string $message * The text of the message. - * @param string|null $messageWrapperQuerySelector + * @param string|null $wrapper_query_selector * The query selector of the element to display messages in when they * should be displayed somewhere other than the default. * @see Drupal.Message.defaultWrapper() - * @param array $messageOptions + * @param array $options * The options passed to Drupal.message().add(). - * @param bool $clearPrevious - * Whether to clear previous messages. + * @param bool $clear_previous + * If TRUE, previous messages will be cleared first. */ - public function __construct($message, $messageWrapperQuerySelector = NULL, array $messageOptions = [], $clearPrevious = TRUE) { + public function __construct($message, $wrapper_query_selector = NULL, array $options = [], $clear_previous = TRUE) { $this->message = $message; - $this->messageWrapperQuerySelector = $messageWrapperQuerySelector; - $this->messageOptions = $messageOptions; - $this->clearPrevious = $clearPrevious; + $this->wrapperQuerySelector = $wrapper_query_selector; + $this->options = $options; + $this->clearPrevious = $clear_previous; } /** @@ -67,8 +67,8 @@ public function render() { return [ 'command' => 'message', 'message' => $this->message, - 'messageWrapperQuerySelector' => $this->messageWrapperQuerySelector, - 'messageOptions' => $this->messageOptions, + 'messageWrapperQuerySelector' => $this->wrapperQuerySelector, + 'messageOptions' => $this->options, 'clearPrevious' => $this->clearPrevious, ]; } diff --git a/core/misc/ajax.es6.js b/core/misc/ajax.es6.js index cd70804c98..905559c921 100644 --- a/core/misc/ajax.es6.js +++ b/core/misc/ajax.es6.js @@ -1564,20 +1564,20 @@ }, /** - * Command to use Drupal.Message() via AJAX command. + * Command to add a message to the message area. * * @param {Drupal.Ajax} [ajax] * {@link Drupal.Ajax} object created by {@link Drupal.ajax}. * @param {object} response * The response from the Ajax request. * @param {string} response.messageWrapperQuerySelector - * The zone where to add the message. If null a default will be used. + * The zone where to add the message. If null, the default will be used. * @param {string} response.message * The message text. * @param {string} response.messageOptions * The options argument for Drupal.Message().add(). * @param {bool} response.clearPrevious - * If TRUE, clear previous messages. + * If true, clear previous messages. */ message(ajax, response) { const messages = new Drupal.Message( diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MessageTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MessageTest.php index 65b6c01384..872d42ed32 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MessageTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MessageTest.php @@ -63,7 +63,6 @@ public function testMessageCommand() { }); $this->assertTrue($expected_count); } - } /**