Implement template v2 feature of pushing to stack

This commit is contained in:
Kijin Sung 2023-10-18 02:23:18 +09:00
parent 7b518ab747
commit c19d71847f
5 changed files with 95 additions and 8 deletions

View file

@ -30,6 +30,7 @@ class Template
public $vars;
protected $_fragments = [];
protected static $_loopvars = [];
protected static $_stacks = [];
/**
* Static properties
@ -411,6 +412,24 @@ class Template
}
}
/**
* Get the contents of a stack.
*
* @param string $name
* @return ?array
*/
public function getStack(string $name): ?array
{
if (isset(self::$_stacks[$name]))
{
return self::$_stacks[$name];
}
else
{
return null;
}
}
/**
* Check if a path should be treated as relative to the path of the current template.
*