mirror of
https://github.com/moodle/moodle.git
synced 2025-03-23 09:00:30 +01:00
Merge branch 'MDL-75379_401' of https://github.com/larsbonczek/moodle into MOODLE_401_STABLE
This commit is contained in:
commit
960bff3227
@ -75,6 +75,11 @@ class renderer_base {
|
||||
*/
|
||||
private $mustache;
|
||||
|
||||
/**
|
||||
* @var array $templatecache The mustache template cache.
|
||||
*/
|
||||
protected $templatecache = array();
|
||||
|
||||
/**
|
||||
* Return an instance of the mustache class.
|
||||
*
|
||||
@ -174,7 +179,6 @@ class renderer_base {
|
||||
* @return string|boolean
|
||||
*/
|
||||
public function render_from_template($templatename, $context) {
|
||||
static $templatecache = array();
|
||||
$mustache = $this->get_mustache();
|
||||
|
||||
try {
|
||||
@ -190,12 +194,12 @@ class renderer_base {
|
||||
// e.g. aria attributes that only work with id attributes and must be
|
||||
// unique in a page.
|
||||
$mustache->addHelper('uniqid', new \core\output\mustache_uniqid_helper());
|
||||
if (isset($templatecache[$templatename])) {
|
||||
$template = $templatecache[$templatename];
|
||||
if (isset($this->templatecache[$templatename])) {
|
||||
$template = $this->templatecache[$templatename];
|
||||
} else {
|
||||
try {
|
||||
$template = $mustache->loadTemplate($templatename);
|
||||
$templatecache[$templatename] = $template;
|
||||
$this->templatecache[$templatename] = $template;
|
||||
} catch (Mustache_Exception_UnknownTemplateException $e) {
|
||||
throw new moodle_exception('Unknown template: ' . $templatename);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user