Security update to Drupal 8.4.6
[yaffs-website] / web / core / lib / Drupal / Core / Ajax / ReplaceCommand.php
1 <?php
2
3 namespace Drupal\Core\Ajax;
4
5 /**
6  * AJAX command for calling the jQuery replace() method.
7  *
8  * The 'insert/replaceWith' command instructs the client to use jQuery's
9  * replaceWith() method to replace each element matched by the given selector
10  * with the given HTML.
11  *
12  * This command is implemented by Drupal.AjaxCommands.prototype.insert()
13  * defined in misc/ajax.js.
14  *
15  * See
16  * @link http://docs.jquery.com/Manipulation/replaceWith#content jQuery replaceWith command @endlink
17  *
18  * @ingroup ajax
19  */
20 class ReplaceCommand extends InsertCommand {
21
22   /**
23    * Implements Drupal\Core\Ajax\CommandInterface:render().
24    */
25   public function render() {
26
27     return [
28       'command' => 'insert',
29       'method' => 'replaceWith',
30       'selector' => $this->selector,
31       'data' => $this->getRenderedContent(),
32       'settings' => $this->settings,
33     ];
34   }
35
36 }