1 | <?php |
||
11 | class PageView extends FrontMatterObject |
||
12 | { |
||
13 | const TEMPLATE = "---\n%s\n---\n\n%s"; |
||
14 | |||
15 | const REPEATER_TYPE = 0; |
||
16 | const DYNAMIC_TYPE = 1; |
||
17 | const STATIC_TYPE = 2; |
||
18 | |||
19 | /** |
||
20 | * @var vfsStreamDirectory |
||
21 | */ |
||
22 | private static $vfsRoot; |
||
23 | |||
24 | /** |
||
25 | * @var Filesystem |
||
26 | */ |
||
27 | private static $fileSys; |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $type; |
||
33 | |||
34 | /** |
||
35 | * @var PageView[] |
||
36 | */ |
||
37 | private $children; |
||
38 | |||
39 | /** |
||
40 | * {@inheritdoc} |
||
41 | */ |
||
42 | 1 | public function __construct($filePath) |
|
49 | |||
50 | // |
||
51 | // Twig Jail |
||
52 | // ========= |
||
53 | |||
54 | /** |
||
55 | * {@inheritdoc} |
||
56 | */ |
||
57 | 1 | public function createJail () |
|
63 | |||
64 | public function getJailedChildren () |
||
75 | |||
76 | // |
||
77 | // Getters |
||
78 | // ======= |
||
79 | |||
80 | /** |
||
81 | * Get child PageViews |
||
82 | * |
||
83 | * A child is defined as a static PageView whose URL has a parent. For example, a PageView with a URL of |
||
84 | * `/gallery/france/` would have the PageView whose URL is `/gallery` as a parent. |
||
85 | * |
||
86 | * @return PageView[] |
||
87 | */ |
||
88 | public function &getChildren () |
||
92 | |||
93 | /** |
||
94 | * @return string Twig body |
||
95 | */ |
||
96 | 1 | public function getContent () |
|
100 | |||
101 | /** |
||
102 | * Returns the type of the PageView |
||
103 | * |
||
104 | * @return string |
||
105 | */ |
||
106 | 1 | public function getType () |
|
110 | |||
111 | /** |
||
112 | * A fallback for the site menus that use the `url` field. |
||
113 | * |
||
114 | * @deprecated 0.1.0 |
||
115 | * @todo Remove this in the next major release |
||
|
|||
116 | */ |
||
117 | public function getUrl () |
||
121 | |||
122 | // |
||
123 | // Factory |
||
124 | // ======= |
||
125 | |||
126 | /** |
||
127 | * Create the appropriate object type when parsing a PageView |
||
128 | * |
||
129 | * @param string $filePath The path to the file that will be parsed into a PageView |
||
130 | * |
||
131 | * @return DynamicPageView|PageView|RepeaterPageView |
||
132 | */ |
||
133 | 1 | public static function create ($filePath) |
|
151 | |||
152 | // |
||
153 | // Virtual PageViews |
||
154 | // ================= |
||
155 | |||
156 | /** |
||
157 | * Create a virtual PageView |
||
158 | * |
||
159 | * @param array $frontMatter The Front Matter that this virtual PageView will have |
||
160 | * @param string $body The body of the virtual PageView |
||
161 | * |
||
162 | * @return PageView |
||
163 | */ |
||
164 | public static function createVirtual ($frontMatter, $body) |
||
178 | |||
179 | /** |
||
180 | * Create a virtual PageView to create redirect files |
||
181 | * |
||
182 | * @param string $redirectFrom The URL that will be redirecting to the target location |
||
183 | * @param string $redirectTo The URL of the destination |
||
184 | * @param string|bool $redirectTemplate The path to the template |
||
185 | * |
||
186 | * @return PageView A virtual PageView with the redirection template |
||
187 | */ |
||
188 | public static function createRedirect ($redirectFrom, $redirectTo, $redirectTemplate = false) |
||
212 | } |
||
213 |
This check looks
TODO
comments that have been left in the code.``TODO``s show that something is left unfinished and should be attended to.