Skip to content

Instantly share code, notes, and snippets.

@Anubarak
Created January 11, 2018 08:06
Show Gist options
  • Save Anubarak/db9e97aac93aaea0fc06742af98f0996 to your computer and use it in GitHub Desktop.
Save Anubarak/db9e97aac93aaea0fc06742af98f0996 to your computer and use it in GitHub Desktop.
class Project_Twig_Extension extends Twig_Extension implements Twig_Extension_GlobalsInterface
{
public function getGlobals()
{
return array(
'craft' => new \craft\web\twig\variables\CraftVariable(),
'entry' => new \craft\elements\Entry(),
'asset' => new \craft\elements\Asset(),
'category' => new \craft\elements\Category(),
'currentUser' => new \craft\elements\User(),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment