Paragraphs Editor
Main Page
Namespaces
Classes
Files
File List
ModalDeliveryProvider.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Drupal\paragraphs_editor\Plugin\ParagraphsEditor\delivery_provider
;
4
5
use
Drupal\Core\Ajax\AjaxResponse
;
6
use
Drupal\paragraphs_editor\Ajax\CloseModalCommand
;
7
use
Drupal\paragraphs_editor\Ajax\DeliverWidgetBinderData
;
8
use
Drupal\paragraphs_editor\Ajax\OpenModalCommand
;
9
use
Drupal\paragraphs_editor\WidgetBinder\WidgetBinderData
;
10
use
Drupal\paragraphs_editor\Plugin\ParagraphsEditor\DeliveryProviderInterface
;
11
use
Drupal\paragraphs_editor\Plugin\ParagraphsEditor\PluginBase
;
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
*/
22
class
ModalDeliveryProvider
extends
PluginBase
implements
DeliveryProviderInterface
{
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
}
Drupal\paragraphs_editor\Ajax\OpenModalCommand
Definition:
OpenModalCommand.php:11
PluginBase
Drupal\paragraphs_editor\Plugin\ParagraphsEditor\delivery_provider\ModalDeliveryProvider\close
close(AjaxResponse $response)
Definition:
ModalDeliveryProvider.php:39
Drupal\paragraphs_editor\Ajax\CloseModalCommand
Definition:
CloseModalCommand.php:11
Drupal\paragraphs_editor\Plugin\ParagraphsEditor\delivery_provider\ModalDeliveryProvider\sendData
sendData(AjaxResponse $response, WidgetBinderData $data)
Definition:
ModalDeliveryProvider.php:46
DeliveryProviderInterface
Drupal\paragraphs_editor\Plugin\ParagraphsEditor\delivery_provider\ModalDeliveryProvider
Definition:
ModalDeliveryProvider.php:22
WidgetBinderData
DeliverWidgetBinderData
Drupal\paragraphs_editor\Ajax\DeliverWidgetBinderData
Definition:
DeliverWidgetBinderData.php:11
Drupal\paragraphs_editor\Plugin\ParagraphsEditor\DeliveryProviderInterface
Definition:
DeliveryProviderInterface.php:21
OpenModalCommand
Drupal\paragraphs_editor\Plugin\ParagraphsEditor\PluginBase
Definition:
PluginBase.php:18
Drupal\paragraphs_editor\Plugin\ParagraphsEditor\delivery_provider\ModalDeliveryProvider\navigate
navigate(AjaxResponse $response, $title, $contents)
Definition:
ModalDeliveryProvider.php:27
CloseModalCommand
Drupal\paragraphs_editor\WidgetBinder\WidgetBinderData
Definition:
WidgetBinderData.php:13
AjaxResponse
Drupal\paragraphs_editor\Plugin\ParagraphsEditor\delivery_provider
Definition:
ModalDeliveryProvider.php:3
src
Plugin
ParagraphsEditor
delivery_provider
ModalDeliveryProvider.php
Generated by
1.8.11