Paragraphs Editor
Main Page
Namespaces
Classes
Files
File List
EditBufferItem.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Drupal\paragraphs_editor\EditBuffer
;
4
5
use
Drupal\paragraphs\ParagraphInterface
;
6
7
/**
8
* Wraps paragraph edits with the buffer that will store those edits.
9
*/
10
class
EditBufferItem
implements
EditBufferItemInterface
{
11
12
/**
13
* The wrapped entity, containing any edits.
14
*
15
* @var \Drupal\paragraphs\ParagraphInterface
16
*/
17
protected
$entity
;
18
19
/**
20
* The buffer that will be used to store the edits.
21
*
22
* @var \Drupal\paragraphs_editor\EditBuffer\EditBufferInterface
23
*/
24
protected
$buffer
;
25
26
/**
27
* Creates an edit buffer item.
28
*
29
* @param \Drupal\paragraphs\ParagraphInterface $entity
30
* The entity to wrap.
31
* @param \Drupal\paragraphs_editor\EditBuffer\EditBufferInterface $buffer
32
* The buffer that will store edits.
33
*/
34
public
function
__construct
(ParagraphInterface
$entity
,
EditBufferInterface
$buffer
) {
35
$this->entity =
$entity
;
36
$this->buffer =
$buffer
;
37
}
38
39
/**
40
* {@inheritdoc}
41
*/
42
public
function
getEntity
() {
43
return
$this->entity
;
44
}
45
46
/**
47
* {@inheritdoc}
48
*/
49
public
function
overwrite
(ParagraphInterface
$entity
) {
50
$this->entity =
$entity
;
51
}
52
53
/**
54
* {@inheritdoc}
55
*/
56
public
function
save
() {
57
$this->buffer->setItem($this)->save();
58
}
59
60
}
Drupal\paragraphs_editor\EditBuffer
Definition:
EditBuffer.php:3
Drupal\paragraphs_editor\EditBuffer\EditBufferItem\__construct
__construct(ParagraphInterface $entity, EditBufferInterface $buffer)
Definition:
EditBufferItem.php:34
Drupal\paragraphs_editor\EditBuffer\EditBufferInterface
Definition:
EditBufferInterface.php:14
ParagraphInterface
Drupal\paragraphs_editor\EditBuffer\EditBufferItem\save
save()
Definition:
EditBufferItem.php:56
Drupal\paragraphs_editor\EditBuffer\EditBufferItem\$buffer
$buffer
Definition:
EditBufferItem.php:24
Drupal\paragraphs_editor\EditBuffer\EditBufferItem\overwrite
overwrite(ParagraphInterface $entity)
Definition:
EditBufferItem.php:49
Drupal\paragraphs_editor\EditBuffer\EditBufferItem\$entity
$entity
Definition:
EditBufferItem.php:17
Drupal\paragraphs_editor\EditBuffer\EditBufferItem\getEntity
getEntity()
Definition:
EditBufferItem.php:42
Drupal\paragraphs_editor\EditBuffer\EditBufferItemInterface
Definition:
EditBufferItemInterface.php:15
Drupal\paragraphs_editor\EditBuffer\EditBufferItem
Definition:
EditBufferItem.php:10
src
EditBuffer
EditBufferItem.php
Generated by
1.8.11