HtmlCommand.php 818 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace Drupal\Core\Ajax;
  3. /**
  4. * AJAX command for calling the jQuery html() method.
  5. *
  6. * The 'insert/html' command instructs the client to use jQuery's html() method
  7. * to set the HTML content of each element matched by the given selector while
  8. * leaving the outer tags intact.
  9. *
  10. * This command is implemented by Drupal.AjaxCommands.prototype.insert()
  11. * defined in misc/ajax.js.
  12. *
  13. * @see http://docs.jquery.com/Attributes/html#val
  14. *
  15. * @ingroup ajax
  16. */
  17. class HtmlCommand extends InsertCommand {
  18. /**
  19. * Implements Drupal\Core\Ajax\CommandInterface:render().
  20. */
  21. public function render() {
  22. return [
  23. 'command' => 'insert',
  24. 'method' => 'html',
  25. 'selector' => $this->selector,
  26. 'data' => $this->getRenderedContent(),
  27. 'settings' => $this->settings,
  28. ];
  29. }
  30. }