Paragraphs Editor
OpenModalCommand.php
Go to the documentation of this file.
1 <?php
2 
4 
7 
8 /**
9  * Opens an ajax dialog for a specific editor context.
10  */
11 class OpenModalCommand extends OpenModalDialogCommand {
12 
13  /**
14  * Creates an OpenModelCommand.
15  *
16  * @param string $title
17  * The title of the dialog.
18  * @param string|array $content
19  * The content that will be placed in the dialog, either a render array
20  * or an HTML string.
21  * @param \Drupal\paragraphs_editor\EditorCommand\CommandContextInterface $context
22  * The context to open the dialog for.
23  * @param array $dialog_options
24  * (optional) Settings to be passed to the dialog implementation. Any
25  * jQuery UI option can be used. See http://api.jqueryui.com/dialog.
26  * @param array|null $settings
27  * (optional) Custom settings that will be passed to the Drupal behaviors
28  * on the content of the dialog. If left empty, the settings will be
29  * populated automatically from the current request.
30  */
31  public function __construct($title, $content, CommandContextInterface $context, array $dialog_options = [], $settings = NULL) {
32  if (empty($dialog_options['width'])) {
33  $dialog_options['width'] = '75%';
34  $dialog_options['dialogClass'] = 'paragraphs-editor-dialog';
35  }
36 
37  parent::__construct($title, $content, $dialog_options, $settings);
38  $this->selector = '#paragraphs-ckeditor-modal-' . md5($context->getContextString());
39  }
40 
41 }
__construct($title, $content, CommandContextInterface $context, array $dialog_options=[], $settings=NULL)