twig
class twig extends base
Twig Template class.
Properties
protected context | $context | Template context. |
from base |
protected array | $filenames | Array of filenames assigned to set_filenames |
from base |
protected path_helper | $path_helper | phpBB path helper |
|
protected string | $phpbb_root_path | phpBB root path |
|
protected string | $php_ext | PHP file extension |
|
protected config | $config | phpBB config instance |
|
protected user | $user | Current user |
|
protected manager | $extension_manager | Extension manager. |
|
protected Environment | $twig | Twig Environment |
Methods
Assign a single scalar value to a single key.
Append text to the string value stored in a key.
Assign key variable pairs from an array to a specified block
Assign key variable pairs from an array to a whole specified block loop
Retrieve variable values from an specified block
Change already assigned key variable pair (one-dimensional - single loop entry)
Find the index for a specified key in the innermost specified block
Constructor.
Clear the cache
Get the style tree of the style preferred by the current user
Set style location based on (current) user's chosen style.
Set custom style location (able to use directory outside of phpBB).
Display the handle and assign the output to a template variable or return the compiled result.
Get template vars in a format Twig will use (from the context)
Get path to template for handle (required for BBCode parser)
Details
in
base at line 36
template
set_filenames(array $filename_array)
Sets the template filenames for handles.
in
base at line 49
protected string
get_filename_from_handle(string $handle)
Get a filename from the handle
in
base at line 90
template
assign_var(string $varname, string $varval)
Assign a single scalar value to a single key.
Value can be a string, an integer or a boolean.
in
base at line 100
template
append_var(string $varname, string $varval)
Append text to the string value stored in a key.
Text is appended using the string concatenation operator (.).
in
base at line 110
array
retrieve_vars(array $vararray)
Retrieve multiple template values
in
base at line 123
mixed
retrieve_var(string $varname)
Retrieve a single scalar value from a single key.
in
base at line 131
template
assign_block_vars(string $blockname, array $vararray)
Assign key variable pairs from an array to a specified block
in
base at line 141
template
assign_block_vars_array(string $blockname, array $block_vars_array)
Assign key variable pairs from an array to a whole specified block loop
in
base at line 151
array
retrieve_block_vars(string $blockname, array $vararray)
Retrieve variable values from an specified block
in
base at line 159
bool
alter_block_array(string $blockname, array $vararray, mixed $key = false, string $mode = 'insert')
Change already assigned key variable pair (one-dimensional - single loop entry)
An example of how to use this function: {@example alter_block_array.php}
in
base at line 167
mixed
find_key_index(string $blockname, mixed $key)
Find the index for a specified key in the innermost specified block
in
base at line 178
protected
call_hook(string $handle, string $method)
Calls hook if any is defined.
at line 88
__construct(path_helper $path_helper, config $config, context $context, environment $twig_environment, string $cache_path, user $user = null, array|ArrayAccess $extensions = array(), manager $extension_manager = null)
Constructor.
at line 117
template
clear_cache()
Clear the cache
at line 134
array
get_user_style()
Get the style tree of the style preferred by the current user
at line 161
template
set_style(array $style_directories = array('styles'))
Set style location based on (current) user's chosen style.
at line 230
template
set_custom_style(string|array $names, string|array $paths)
Set custom style location (able to use directory outside of phpBB).
Note: Templates are still compiled to phpBB's cache directory.
at line 309
template
display(string $handle)
Display a template for provided handle.
The template will be loaded and compiled, if necessary, first.
This function calls hooks.
at line 331
template|string
assign_display(string $handle, string $template_var = '', bool $return_content = true)
Display the handle and assign the output to a template variable or return the compiled result.
at line 348
protected array
get_template_vars()
Get template vars in a format Twig will use (from the context)
at line 380
string
get_source_file_for_handle(string $handle)
Get path to template for handle (required for BBCode parser)