-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathContentVersion.php
More file actions
81 lines (62 loc) · 1.78 KB
/
ContentVersion.php
File metadata and controls
81 lines (62 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
namespace Softspring\CmsBundle\Model;
use InvalidArgumentException;
abstract class ContentVersion implements ContentVersionInterface
{
use Traits\ContentDataTrait;
use Traits\CompilableTrait;
use Traits\VersionTrait;
protected ?ContentInterface $content = null;
protected ?string $layout = null;
protected ?array $seo = null;
protected mixed $_getSeoCallback = null;
protected mixed $_rawSeo = null;
public function getContent(): ?ContentInterface
{
return $this->content;
}
public function setContent(?ContentInterface $content): void
{
$this->content = $content;
}
public function setParent(?VersionableInterface $parent): void
{
if ($parent && !$parent instanceof ContentInterface) {
throw new InvalidArgumentException('Parent must implement ContentInterface');
}
$this->setContent($parent);
}
public function getParent(): ?VersionableInterface
{
return $this->getContent();
}
public function getLayout(): ?string
{
return $this->layout;
}
public function setLayout(?string $layout): void
{
$this->layout = $layout;
}
public function _setSeoCallback(callable $getSeoCallback): void
{
$this->_getSeoCallback = $getSeoCallback;
}
public function getSeo(): ?array
{
if ($this->_getSeoCallback) {
$this->_rawSeo = $this->seo;
$this->seo = call_user_func($this->_getSeoCallback, $this->seo);
$this->_getSeoCallback = null;
}
return $this->seo;
}
public function setSeo(?array $seo): void
{
$this->seo = $seo;
}
public function getRawSeo(): ?array
{
return $this->_rawSeo ?? $this->seo;
}
}