mirror of
https://github.com/getgrav/grav.git
synced 2026-03-02 10:31:41 +01:00
support climbing up the page structure looking for a header variable
Signed-off-by: Andy Miller <rhuk@mac.com>
This commit is contained in:
@@ -1377,6 +1377,11 @@ class TwigExtension extends AbstractExtension implements GlobalsInterface
|
||||
public function pageHeaderVarFunc($context, $var, $pages = null)
|
||||
{
|
||||
if ($pages === null) {
|
||||
$page = $context['page'];
|
||||
while (!$page->root()) {
|
||||
$pages[] = $page;
|
||||
$page = $page->parent();
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure pages are an array
|
||||
|
||||
Reference in New Issue
Block a user