Paragraphs Editor
ResponseHandlerInterface.php
Go to the documentation of this file.
1 <?php
2 
4 
6 
7 /**
8  * Delivers ajax responses for editor commands.
9  *
10  * The response handler layer sits directly above the plugin layer. It is
11  * responsible for directing plugins on how to behave. If you want to override
12  * some functionality that you can't override by simply writing a plugin, such
13  * as replacing the edit form, you can do so by providing an overwridden
14  * response handler service.
15  *
16  * The methods in this class deal with "items" instead of "entities". Items are
17  * loose wrappers around entities that provide an interface for writing the
18  * entities to a persistent editor state storage while users are editing the
19  * form, but before they have submitted.
20  */
22 
23  /**
24  * Responds to an insert request by providing a bundle selection form.
25  *
26  * When a user clicks the "insert paragraph" Editor toolbar button, it
27  * generates a generic insert request. From that point, the user needs to
28  * decide what type of bundle they want to insert. This handler delivers the
29  * form where they select the bundle.
30  *
31  * @param \Drupal\paragraphs_editor\EditorCommand\CommandContextInterface $context
32  * The context the command is being executed in.
33  *
34  * @return \Symfony\Component\HttpFoundation\Response
35  * A symfony response object to return to the user.
36  */
37  public function deliverBundleSelectForm(CommandContextInterface $context);
38 
39  /**
40  * Responds to an edit item request by delivering an edit form.
41  *
42  * @param \Drupal\paragraphs_editor\EditorCommand\CommandContextInterface $context
43  * The context the command is being executed in.
44  * @param \Drupal\paragraphs_editor\EditBuffer\EditBufferItemInterface $item
45  * The buffer item to show the edit form for.
46  *
47  * @return \Symfony\Component\HttpFoundation\Response
48  * A symfony response object to return to the user.
49  */
51 
52  /**
53  * Responds to an insert item request by rendering and delivering the item.
54  *
55  * In this case, the item is a wrapper around a newly created paragraph item
56  * whose state has been stored. At this point the response handler just needs
57  * to render and deliver it.
58  *
59  * @param \Drupal\paragraphs_editor\EditorCommand\CommandContextInterface $context
60  * The context the command is being executed in.
61  * @param \Drupal\paragraphs_editor\EditBuffer\EditBufferItemInterface $item
62  * The buffer item to show the edit form for.
63  *
64  * @return \Symfony\Component\HttpFoundation\Response
65  * A symfony response object to return to the user.
66  */
68 
69  /**
70  * Respond to an item duplication request.
71  *
72  * @param \Drupal\paragraphs_editor\EditorCommand\CommandContextInterface $context
73  * The context the command is being executed in.
74  * @param \Drupal\paragraphs_editor\EditBuffer\EditBufferItemInterface $item
75  * The buffer item to duplicate.
76  * @param string $ckeditor_widget_id
77  * The Editor widget instance id that the duplicate will be copied to.
78  *
79  * @return \Symfony\Component\HttpFoundation\Response
80  * A symfony response object to return to the user.
81  */
82  public function deliverDuplicate(CommandContextInterface $context, EditBufferItemInterface $item, $ckeditor_widget_id);
83 
84  /**
85  * Respond to a close form request.
86  *
87  * @param \Drupal\paragraphs_editor\EditorCommand\CommandContextInterface $context
88  * The context the command is being executed in.
89  *
90  * @return \Symfony\Component\HttpFoundation\Response
91  * A symfony response object to return to the user.
92  */
93  public function deliverCloseForm(CommandContextInterface $context);
94 
95 }
deliverParagraphEditForm(CommandContextInterface $context, EditBufferItemInterface $item)
deliverRenderedParagraph(CommandContextInterface $context, EditBufferItemInterface $item)
deliverDuplicate(CommandContextInterface $context, EditBufferItemInterface $item, $ckeditor_widget_id)