Skip to content

Instantly share code, notes, and snippets.

@jsifalda
Last active August 29, 2015 14:01
Show Gist options
  • Save jsifalda/8e781e6fc3a04038f44a to your computer and use it in GitHub Desktop.
Save jsifalda/8e781e6fc3a04038f44a to your computer and use it in GitHub Desktop.
<?php
class MacroInstaller extends Latte\Macros\MacroSet
{
const OUTPUT = 'do-everything-with-that';
/**
* @param Compiler $compiler
* @return void|static
*/
public static function install(Latte\Compiler $compiler)
{
$me = new static($compiler);
$me->addMacro('macroName', "echo '" . self::OUTPUT . "'");
}
}
class MacroExtension extends Nette\DI\CompilerExtension implements Flame\Modules\Providers\ILatteMacrosProvider
{
/**
* Get array of latte macros classes
*
* @return array
*/
public function getLatteMacros()
{
return array(
'MacroInstaller'
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment