Paragraphs Editor
EditBufferItemFactoryInterface.php
Go to the documentation of this file.
1 <?php
2 
4 
6 
7 /**
8  * Represents a factory for creating edit buffer items.
9  */
11 
12  /**
13  * Creates a buffer item within a context.
14  *
15  * This should never be called inside an access check. Only call this after
16  * context validation has completed successfully.
17  *
18  * @param \Drupal\paragraphs_editor\EditorCommand\CommandContextInterface $context
19  * The context for the editor instance.
20  * @param string $bundle_name
21  * The bundle name for the paragraph to be created.
22  *
23  * @return \Drupal\paragraphs_editor\EditBuffer\EditBufferItemInterface
24  * The newly created edit buffer item.
25  */
26  public function createBufferItem(CommandContextInterface $context, $bundle_name);
27 
28  /**
29  * Retrieves a paragraph item from within a context buffer.
30  *
31  * This is safe to call within access checks since we verify that the buffer
32  * is set before using it. This will create the paragraph item in the buffer
33  * it does not already exist.
34  *
35  * @param \Drupal\paragraphs_editor\EditorCommand\CommandContextInterface $context
36  * The context for the editor instance.
37  * @param string $paragraph_uuid
38  * The uuid of the paragraph to retrieve.
39  *
40  * @return \Drupal\paragraphs_editor\EditBuffer\EditBufferItemInterface
41  * The newly created edit buffer item.
42  */
43  public function getBufferItem(CommandContextInterface $context, $paragraph_uuid);
44 
45  /**
46  * Duplicates an edit buffer item.
47  *
48  * This duplicates the paragraph contained in the edit buffer item and creates
49  * a new edit buffer item to contain the duplicate paragraph.
50  *
51  * @param \Drupal\paragraphs_editor\EditorCommand\CommandContextInterface $context
52  * The context that will receive the newly created edit buffer item.
53  * @param \Drupal\paragraphs_editor\EditBuffer\EditBufferItemInterface $item
54  * The item to be duplicated.
55  *
56  * @return \Drupal\paragraphs_editor\EditBuffer\EditBufferItemInterface
57  * The newly created edit buffer item.
58  */
60 
61 }
duplicateBufferItem(CommandContextInterface $context, EditBufferItemInterface $item)
getBufferItem(CommandContextInterface $context, $paragraph_uuid)
createBufferItem(CommandContextInterface $context, $bundle_name)