1 | <?php namespace Modules\Page\Composers; |
||
7 | class TemplateViewComposer |
||
8 | { |
||
9 | /** |
||
10 | * @var ThemeManager |
||
11 | */ |
||
12 | private $themeManager; |
||
13 | /** |
||
14 | * @var Filesystem |
||
15 | */ |
||
16 | private $finder; |
||
17 | |||
18 | public function __construct(ThemeManager $themeManager, Filesystem $finder) |
||
23 | |||
24 | public function compose(View $view) |
||
28 | |||
29 | private function getTemplates() |
||
54 | |||
55 | /** |
||
56 | * Get the base path of the current theme. |
||
57 | * |
||
58 | * @return string |
||
59 | */ |
||
60 | private function getCurrentThemeBasePath() |
||
64 | |||
65 | /** |
||
66 | * Read template name defined in comments. |
||
67 | * |
||
68 | * @param $template |
||
69 | * |
||
70 | * @return string |
||
71 | */ |
||
72 | private function getTemplateName($template) |
||
82 | |||
83 | /** |
||
84 | * If the template name is not defined in comments, build a default. |
||
85 | * |
||
86 | * @param $template |
||
87 | * |
||
88 | * @return mixed |
||
89 | */ |
||
90 | private function getDefaultTemplateName($template) |
||
97 | |||
98 | /** |
||
99 | * Check if the given path is a layout or a partial. |
||
100 | * |
||
101 | * @param string $relativePath |
||
102 | * |
||
103 | * @return bool |
||
104 | */ |
||
105 | private function isLayoutOrPartial($relativePath) |
||
109 | |||
110 | /** |
||
111 | * Remove the extension from the filename. |
||
112 | * |
||
113 | * @param $template |
||
114 | * |
||
115 | * @return mixed |
||
116 | */ |
||
117 | private function removeExtensionsFromFilename($template) |
||
121 | |||
122 | /** |
||
123 | * Check if the relative path is not empty (meaning the template is in a directory). |
||
124 | * |
||
125 | * @param $relativePath |
||
126 | * |
||
127 | * @return bool |
||
128 | */ |
||
129 | private function hasSubdirectory($relativePath) |
||
133 | } |
||
134 |