-
Notifications
You must be signed in to change notification settings - Fork 454
/
PlannedSlot.php
81 lines (68 loc) · 1.91 KB
/
PlannedSlot.php
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
<?php
namespace Concrete\Core\Board\Instance\Slot\Planner;
use Concrete\Core\Board\Instance\Slot\Content\ItemObjectGroup;
use Concrete\Core\Board\Instance\Slot\Content\ObjectCollection;
use Concrete\Core\Design\Tag\ProvidesTagsInterface;
use Concrete\Core\Design\Tag\Tag;
use Concrete\Core\Design\Tag\TagCollection;
use Concrete\Core\Entity\Board\SlotTemplate;
/**
* Joins content objects to a template and slot number. A simple object that we can use to store values BEFORE
* we actually populate block content and save items to the database.
*/
class PlannedSlot implements ProvidesTagsInterface
{
/**
* @var int
*/
protected $slot = 0;
/**
* @var PlannedSlotTemplate
*/
protected $template;
/**
* @return int
*/
public function getSlot(): int
{
return $this->slot;
}
/**
* @param int $slot
*/
public function setSlot(int $slot): void
{
$this->slot = $slot;
}
/**
* @return PlannedSlotTemplate
*/
public function getTemplate(): PlannedSlotTemplate
{
return $this->template;
}
/**
* @param PlannedSlotTemplate $template
*/
public function setTemplate(PlannedSlotTemplate $template): void
{
$this->template = $template;
}
public function getDesignTags(): array
{
$return = [];
$slotTemplateTags = $this->getTemplate()->getSlotTemplate()->getTags();
foreach($slotTemplateTags as $slotTemplateTag) {
$return[] = $slotTemplateTag;
}
$contentObjectCollection = $this->getTemplate()->getObjectCollection();
$contentObjects = $contentObjectCollection->getContentObjects();
foreach($contentObjects as $contentObject) {
$tags = $contentObject->getDesignTags();
foreach($tags as $tag) {
$return[] = $tag;
}
}
return $return;
}
}