Paragraphs Editor
ModalDeliveryProvider.php
Go to the documentation of this file.
1 <?php
2 
4 
12 
13 /**
14  * Delivers paragraphs editor forms in a modal dialog.
15  *
16  * @ParagraphsEditorDeliveryProvider(
17  * id = "modal",
18  * title = @Translation("Modal"),
19  * description = @Translation("Shows forms in a modal dialog.")
20  * )
21  */
23 
24  /**
25  * {@inheritdoc}
26  */
27  public function navigate(AjaxResponse $response, $title, $contents) {
28  $response->setAttachments([
29  'library' => [
30  'core/drupal.dialog.ajax',
31  ],
32  ]);
33  $response->addCommand(new OpenModalCommand($title, $contents, $this->context));
34  }
35 
36  /**
37  * {@inheritdoc}
38  */
39  public function close(AjaxResponse $response) {
40  $response->addCommand(new CloseModalCommand($this->context));
41  }
42 
43  /**
44  * {@inheritdoc}
45  */
46  public function sendData(AjaxResponse $response, WidgetBinderData $data) {
47  $response->addCommand(new DeliverWidgetBinderData($this->context->getAdditionalContext('module'), $data));
48  }
49 
50 }