com\setasign\Konquadrat\Workflow\Renderer\Twig
WorkflowTwigEnvironment Stores the Twig configuration and renders templates.
File: /Konquadrat/src/Workflow/Renderer/Twig/WorkflowTwigEnvironment.php
Class hierarchy
- Twig\Environment
Summary
Methods
- __construct()
- addExtension()
- addFilter()
- addFunction()
- addGlobal()
- addNodeVisitor()
- addRuntimeLoader()
- addTest()
- addTokenParser()
- compile()
- compileSource()
- createTemplate()
- disableAutoReload()
- disableDebug()
- disableStrictVariables()
- display()
- enableAutoReload()
- enableDebug()
- enableStrictVariables()
- getCache()
- getCharset()
- getExtension()
- getExtensions()
- getGlobals()
- getLoader()
- getRuntime()
- hasExtension()
- isAutoReload()
- isDebug()
- isStrictVariables()
- isTemplateFresh()
- load()
- mergeGlobals()
- parse()
- registerUndefinedFilterCallback()
- registerUndefinedFunctionCallback()
- registerUndefinedTestCallback()
- registerUndefinedTokenParserCallback()
- removeCache()
- render()
- resetGlobals()
- resolveTemplate()
- setCache()
- setCharset()
- setCompiler()
- setExtensions()
- setLexer()
- setLoader()
- setParser()
- tokenize()
- updateOptionsHash()
Constants
EXTRA_VERSION
MAJOR_VERSION
MINOR_VERSION
RELEASE_VERSION
VERSION
VERSION_ID
Methods
__construct()
\com\setasign\Konquadrat\DirectorySettings $directorySettings,
\com\setasign\SetaFramework\Bootstrap\Bootstrap $bootstrap,
\com\setasign\SetaFramework\Bootstrap\DomainName $domainName,
\com\setasign\SetaFramework\Di\Di $di,
\com\setasign\Konquadrat\Workflow\Workflow $workflow
Parameters
- $applicationConfig: \com\setasign\SetaFramework\Application\ApplicationConfig
- $directorySettings: \com\setasign\Konquadrat\DirectorySettings
- $bootstrap: \com\setasign\SetaFramework\Bootstrap\Bootstrap
- $domainName: \com\setasign\SetaFramework\Bootstrap\DomainName
- $di: \com\setasign\SetaFramework\Di\Di
- $workflow: \com\setasign\Konquadrat\Workflow\Workflow
addExtension()
-
Parameters
- $extension: \Twig\Extension\ExtensionInterface
addFilter()
-
Parameters
- $filter: \Twig\TwigFilter
addFunction()
-
Parameters
- $function: \Twig\TwigFunction
addGlobal()
-
$value
Registers a Global.
New globals can be added before compiling or rendering a template; but after, you can only update existing globals.
Parameters
- $name: mixed
The global value
- $value
addNodeVisitor()
-
Parameters
- $visitor: \Twig\NodeVisitor\NodeVisitorInterface
addRuntimeLoader()
-
Parameters
- $loader: \Twig\RuntimeLoader\RuntimeLoaderInterface
addTest()
-
Parameters
- $test: \Twig\TwigTest
addTokenParser()
-
Parameters
- $parser: \Twig\TokenParser\TokenParserInterface
compile()
-
Compiles a node and returns the PHP code.
Parameters
- $node: \Twig\Node\Node
compileSource()
-
Compiles a template source code.
Parameters
- $source: \Twig\Source
Exceptions
Throws \Twig\Error\SyntaxError When there was an error during tokenizing, parsing or compiling
createTemplate()
-
?string $name = null
Creates a template from source.
This method should not be used as a generic way to load templates.
Parameters
- $template: string
The template source
- $name: ?string
An optional name of the template to be used in error messages
Exceptions
Throws \Twig\Error\LoaderError When the template cannot be found
Throws \Twig\Error\SyntaxError When an error occurred during compilation
disableAutoReload()
-
Disables the auto_reload option.
disableStrictVariables()
-
Disables the strict_variables option.
display()
-
array $context = array ( )
Displays a template.
Parameters
- $name: string|\Twig\TemplateWrapper
The template name
- $context: array
Exceptions
Throws \Twig\Error\LoaderError When the template cannot be found
Throws \Twig\Error\SyntaxError When an error occurred during compilation
Throws \Twig\Error\RuntimeError When an error occurred during rendering
enableAutoReload()
-
Enables the auto_reload option.
enableStrictVariables()
-
Enables the strict_variables option.
getCache()
-
Gets the current cache implementation.
Parameters
- $original: bool
Whether to return the original cache option or the real cache instance
Return Values
A Twig\Cache\CacheInterface implementation, an absolute path to the compiled templates, or false to disable cache
getExtension()
-
Templates
- TExtension of \Twig\ExtensionInterface
Parameters
- $class: \Twig\class-string<\Twig\TExtension>
getExtensions()
-
Return Values
An array of extensions (keys are for internal usage only and should not be relied on)
getRuntime()
-
Returns the runtime implementation of a Twig element (filter/function/tag/test).
Templates
- TRuntime of \Twig\object
Parameters
- $class: \Twig\class-string<\Twig\TRuntime>
A runtime class name
Return Values
The runtime implementation
Exceptions
Throws \Twig\Error\RuntimeError When the template cannot be found
hasExtension()
-
Parameters
- $class: string
isAutoReload()
-
Checks if the auto_reload option is enabled.
Return Values
true if auto_reload is enabled, false otherwise
isDebug()
-
Checks if debug mode is enabled.
Return Values
true if debug mode is enabled, false otherwise
isStrictVariables()
-
Checks if the strict_variables option is enabled.
Return Values
true if strict_variables is enabled, false otherwise
isTemplateFresh()
-
int $time
Returns true if the template is still fresh.
Besides checking the loader for freshness information, this method also checks if the enabled extensions have not changed.
Parameters
- $name: int
The last modification time of the cached template
- $time: int
load()
-
Loads a template.
Parameters
- $name: string|\Twig\TemplateWrapper
The template name
Exceptions
Throws \Twig\Error\LoaderError When the template cannot be found
Throws \Twig\Error\RuntimeError When a previously generated cache is corrupted
Throws \Twig\Error\SyntaxError When an error occurred during compilation
mergeGlobals()
-
WARNING: This method is marked as deprecated!
since Twig 3.14
Parameters
- $context: array
parse()
-
Converts a token stream to a node tree.
Parameters
- $stream: \Twig\TokenStream
Exceptions
Throws \Twig\Error\SyntaxError When the token stream is syntactically or semantically wrong
registerUndefinedFilterCallback()
-
string
): \Twig\TwigFilter|false $callable
Parameters
- $callable: callable(
string
): \Twig\TwigFilter|false
registerUndefinedFunctionCallback()
-
string
): \Twig\TwigFunction|false $callable
Parameters
- $callable: callable(
string
): \Twig\TwigFunction|false
registerUndefinedTestCallback()
-
string
): \Twig\TwigTest|false $callable
Parameters
- $callable: callable(
string
): \Twig\TwigTest|false
registerUndefinedTokenParserCallback()
-
string
): \Twig\TokenParser\TokenParserInterface|false $callable
Parameters
- $callable: callable(
string
): \Twig\TokenParser\TokenParserInterface|false
render()
-
array $context = array ( )
Renders a template.
Parameters
- $name: string|\Twig\TemplateWrapper
The template name
- $context: array
Exceptions
Throws \Twig\Error\LoaderError When the template cannot be found
Throws \Twig\Error\SyntaxError When an error occurred during compilation
Throws \Twig\Error\RuntimeError When an error occurred during rendering
resolveTemplate()
-
Tries to load a template consecutively from an array.
Similar to load() but it also accepts instances of \Twig\TemplateWrapper and an array of templates where each is tried to be loaded.
Parameters
- $names: string|\Twig\TemplateWrapper|array<string|\Twig\TemplateWrapper>
A template or an array of templates to try consecutively
Exceptions
Throws \Twig\Error\LoaderError When none of the templates can be found
Throws \Twig\Error\SyntaxError When an error occurred during compilation
setCache()
-
Sets the current cache implementation.
Parameters
- $cache: \Twig\Cache\CacheInterface|string|false
A Twig\Cache\CacheInterface implementation, an absolute path to the compiled templates, or false to disable cache
setCharset()
-
Parameters
- $charset: string
setCompiler()
-
Parameters
- $compiler: \Twig\Compiler
setExtensions()
-
Parameters
- $extensions: \Twig\Extension\ExtensionInterface[]
An array of extensions
setLexer()
-
Parameters
- $lexer: \Twig\Lexer
setLoader()
-
Parameters
- $loader: \Twig\Loader\LoaderInterface
setParser()
-
Parameters
- $parser: \Twig\Parser
tokenize()
-
Parameters
- $source: \Twig\Source
Exceptions
Throws \Twig\Error\SyntaxError When the code is syntactically wrong
