processwire-requests
processwire-requests copied to clipboard
Documentation addendum for api-vars access
Access api vars from templates using $this->{api-var-name}
Inside pw template files and all partials included using wireRenderFile($template, $vars) aka $files->render($template, $vars) $this refers to the TemplateFile instance, so we can access api-vars in the following way:
<?php namespace ProcessWire;
// Next line add autocompletion for $this
/** @var TemplateFile $this */
$this->page;
$this->files->render('view/layout.html.php', get_defined_vars());
// etc...