CloseModalCommand::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Drupal\paragraphs_editor\Ajax;
4
5
use Drupal\Core\Ajax\CloseModalDialogCommand;
6
use Drupal\paragraphs_editor\EditorCommand\CommandContextInterface;
7
8
/**
9
 * Closes an ajax dialog for a specific editor context.
10
 */
11
class CloseModalCommand extends CloseModalDialogCommand {
12
13
  /**
14
   * Creates a CloseModelCommand.
15
   *
16
   * @param \Drupal\paragraphs_editor\EditorCommand\CommandContextInterface $context
17
   *   The context to close the dialog for.
18
   * @param bool $persist
19
   *   (optional) Whether to persist the dialog in the DOM or not.
20
   */
21
  public function __construct(CommandContextInterface $context, $persist = FALSE) {
22
    parent::__construct($persist);
23
    $this->selector = '#paragraphs-ckeditor-modal-' . md5($context->getContextString());
24
  }
25
26
}
27