$replaceFunction
$replaceFunction : callable
A plug-in can be used both as an extension (globally enabled with MyPlugin::enable()) or as a module scoped to a given renderer (with MyPlugin::enable($renderer)).
$renderer : \Phug\Renderer
enable(\Phug\Renderer|null $renderer = null)
Enable a plugin as both an extension and a module either globally or on a given renderer.
\Phug\Renderer|null | $renderer |
attachEvent(string $event, callable $callback, integer $priority) : boolean
Attaches a listener to an event.
string | $event | the event to attach too |
callable | $callback | a callable function |
integer | $priority | the priority at which the $callback executed |
true on success false on failure
__construct(\Phug\Renderer $renderer)
\Phug\Renderer | $renderer |
handleTokenEvent(\Phug\Lexer\Event\TokenEvent $tokenEvent)
\Phug\Lexer\Event\TokenEvent | $tokenEvent |
handleNodeEvent(\Phug\Compiler\Event\NodeEvent $nodeEvent)
\Phug\Compiler\Event\NodeEvent | $nodeEvent |
handleFormatEvent(\Phug\Formatter\Event\FormatEvent $formatEvent)
\Phug\Formatter\Event\FormatEvent | $formatEvent |
getRenderer() : \Phug\Renderer
Get the current renderer instance (container of the plugin).
getCompiler() : \Phug\CompilerInterface
Get the current compiler instance (used by the renderer).
getFormatter() : \Phug\Formatter
Get the current formatter instance (used by the compiler).
getParser() : \Phug\Parser
Get the current parser instance (used by the compiler).
getLexer() : \Phug\Lexer
Get the current lexer instance (used by the parser).
getEventContainer(string $event) : \Phug\Util\ModuleContainerInterface
Get the container able to listen the given event.
string | $event | the event to be listenable |
getTokenGenerator(array<mixed,callable> $callbacks, \Phug\Partial\iterable $tokens) : \Phug\Partial\iterable
Get a iterable list of output tokens from a list of interceptors and input tokens.
array<mixed,callable> | $callbacks | list of callable interceptors |
\Phug\Partial\iterable | $tokens | input tokens |
activateOnRenderer(\Phug\Renderer $renderer)
\Phug\Renderer | $renderer |