You are here

CloseBootstrap4ModalDialogCommand.php in Bootstrap 4 Modal 8

Same filename and directory in other branches
  1. 2.x src/Ajax/CloseBootstrap4ModalDialogCommand.php

File

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

namespace Drupal\bootstrap4_modal\Ajax;

use Drupal\Core\Ajax\CloseModalDialogCommand;

/**
 * Defines an AJAX command that closes the currently visible modal dialog.
 *
 * @ingroup ajax
 */
class CloseBootstrap4ModalDialogCommand extends CloseModalDialogCommand {

  /**
   * Constructs a CloseModalDialogCommand object.
   *
   * @param bool $persist
   *   (optional) Whether to persist the dialog in the DOM or not.
   */
  public function __construct($persist = FALSE) {
    parent::__construct($persist);
    $this->selector = '#drupal-bootstrap4-modal';
  }

  /**
   * {@inheritdoc}
   */
  public function render() {
    return [
      'command' => 'closeBootstrap4Dialog',
      'selector' => $this->selector,
      'persist' => $this->persist,
    ];
  }

}

Classes

Namesort descending Description
CloseBootstrap4ModalDialogCommand Defines an AJAX command that closes the currently visible modal dialog.