1 | <?php |
||
10 | class DynamicPageView extends PageView |
||
11 | { |
||
12 | /** |
||
13 | * The Content Items that belong to this Page View. This array will only have elements if it is a dynamic Page View. |
||
14 | * |
||
15 | * @var ContentItem[] |
||
16 | */ |
||
17 | private $repeatableItems; |
||
18 | |||
19 | /** |
||
20 | * {@inheritdoc} |
||
21 | */ |
||
22 | 6 | public function __construct($filePath) |
|
29 | |||
30 | /** |
||
31 | * Add a ContentItem to this Dynamic PageView. |
||
32 | * |
||
33 | * @param TwigDocumentInterface $repeatableItem |
||
34 | */ |
||
35 | 2 | public function addRepeatableItem(&$repeatableItem) |
|
36 | { |
||
37 | 2 | $filename = $this->fs->getBaseName($repeatableItem->getFilePath()); |
|
38 | |||
39 | 2 | $this->repeatableItems[$filename] = &$repeatableItem; |
|
40 | 2 | $repeatableItem->setPageView($this); |
|
41 | 2 | } |
|
42 | |||
43 | /** |
||
44 | * Get all of the ContentItems that belong to this Dynamic PageView. |
||
45 | * |
||
46 | * @return ContentItem[] |
||
47 | */ |
||
48 | 2 | public function getRepeatableItems() |
|
49 | { |
||
50 | 2 | return $this->repeatableItems; |
|
51 | } |
||
52 | |||
53 | /** |
||
54 | * Get the collection name this dynamic PageView is charged with. |
||
55 | * |
||
56 | * @return string |
||
57 | */ |
||
58 | public function getCollection() |
||
59 | { |
||
60 | return $this->getFrontMatter(false)['collection']; |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * Get the dataset name this dynamic PageView is charged with. |
||
65 | * |
||
66 | * @return string |
||
67 | */ |
||
68 | public function getDataset() |
||
72 | |||
73 | public function getRepeatableName() |
||
|
|||
74 | { |
||
75 | $fm = $this->getFrontMatter(false); |
||
84 | } |
||
85 |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@return
annotation as described here.