CloseDialogCommand.php

Contains \Drupal\Core\Ajax\CloseDialogCommand.

Namespace

Drupal\Core\Ajax

File

drupal/core/lib/Drupal/Core/Ajax/CloseDialogCommand.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * Contains \Drupal\Core\Ajax\CloseDialogCommand.
  5. */
  6. namespace Drupal\Core\Ajax;
  7. /**
  8. * Defines an AJAX command that closes the current active dialog.
  9. */
  10. class CloseDialogCommand implements CommandInterface {
  11. /**
  12. * A CSS selector string of the dialog to close.
  13. *
  14. * @var string
  15. */
  16. protected $selector;
  17. /**
  18. * Constructs a CloseDialogCommand object.
  19. *
  20. * @param string $selector
  21. * A CSS selector string of the dialog to close.
  22. */
  23. public function __construct($selector = NULL) {
  24. $this->selector = $selector ? $selector : '#drupal-modal';
  25. }
  26. /**
  27. * Implements \Drupal\Core\Ajax\CommandInterface::render().
  28. */
  29. public function render() {
  30. return array(
  31. 'command' => 'closeDialog',
  32. 'selector' => $this->selector,
  33. );
  34. }
  35. }

Classes

Namesort descending Description
CloseDialogCommand Defines an AJAX command that closes the current active dialog.