Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
ff444c3e
Commit
ff444c3e
authored
Jan 04, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updatd TwigRenderer docs, closes #1771
parent
f4bde7a2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
28 deletions
+23
-28
ViewRenderer.php
extensions/yii/twig/ViewRenderer.php
+23
-28
No files found.
extensions/yii/twig/ViewRenderer.php
View file @
ff444c3e
...
@@ -26,63 +26,58 @@ class ViewRenderer extends BaseViewRenderer
...
@@ -26,63 +26,58 @@ class ViewRenderer extends BaseViewRenderer
* @var string the directory or path alias pointing to where Twig cache will be stored.
* @var string the directory or path alias pointing to where Twig cache will be stored.
*/
*/
public
$cachePath
=
'@runtime/Twig/cache'
;
public
$cachePath
=
'@runtime/Twig/cache'
;
/**
/**
* @var array Twig options
* @var array Twig options
.
* @see http://twig.sensiolabs.org/doc/api.html#environment-options
* @see http://twig.sensiolabs.org/doc/api.html#environment-options
*/
*/
public
$options
=
[];
public
$options
=
[];
/**
/**
* @var array Objects or static classes
* @var array Objects or static classes
.
* Keys of
array are names to call in template, values - objects or names of static class as string
* Keys of
the array are names to call in template, values are objects or names of static classes.
* Example:
['html' => '\yii\helpers\Html']
* Example:
`['html' => '\yii\helpers\Html']`.
*
Than in template: {{ html.link('Login', 'site/login') }}
*
In the template you can use it like this: `{{ html.a('Login', 'site/login') | raw }}`.
*/
*/
public
$globals
=
[];
public
$globals
=
[];
/**
/**
* @var array Custom functions
* @var array Custom functions
.
* Keys of
array are names to call in template, values - names of functions or static methods of some class
* Keys of
the array are names to call in template, values are names of functions or static methods of some class.
* Example:
['rot13' => 'str_rot13', 'link' => '\yii\helpers\Html::link']
* Example:
`['rot13' => 'str_rot13', 'a' => '\yii\helpers\Html::a']`.
*
Than in template: {{ rot13('test') }} or {{ link('Login', 'site/login') }}
*
In the template you can use it like this: `{{ rot13('test') }}` or `{{ a('Login', 'site/login') | raw }}`.
*/
*/
public
$functions
=
[];
public
$functions
=
[];
/**
/**
* @var array Custom filters
* @var array Custom filters
.
* Keys of
array are names to call in template, values - names of functions or static methods of some class
* Keys of
the array are names to call in template, values are names of functions or static methods of some class.
* Example:
['rot13' => 'str_rot13', 'jsonEncode' => '\yii\helpers\Json::encode']
* Example:
`['rot13' => 'str_rot13', 'jsonEncode' => '\yii\helpers\Json::encode']`.
*
Then in template: {{ 'test'|rot13 }} or {{ model|jsonEncode }}
*
In the template you can use it like this: `{{ 'test'|rot13 }}` or `{{ model|jsonEncode }}`.
*/
*/
public
$filters
=
[];
public
$filters
=
[];
/**
/**
* @var array Custom extensions
* @var array Custom extensions
.
* Example:
['Twig_Extension_Sandbox', 'Twig_Extension_Text']
* Example:
`['Twig_Extension_Sandbox', 'Twig_Extension_Text']`
*/
*/
public
$extensions
=
[];
public
$extensions
=
[];
/**
/**
* @var array Twig lexer options
* @var array Twig lexer options
.
*
@see http://twig.sensiolabs.org/doc/recipes.html#customizing-the-syntax
*
Example: Smarty-like syntax:
*
Example: Smarty-like syntax
*
```php
*
array(
*
[
* 'tag_comment' => ['{*', '*}'],
* 'tag_comment' => ['{*', '*}'],
* 'tag_block' => ['{', '}'],
* 'tag_block' => ['{', '}'],
* 'tag_variable' => ['{$', '}']
* 'tag_variable' => ['{$', '}']
* )
* ]
* ```
* @see http://twig.sensiolabs.org/doc/recipes.html#customizing-the-syntax
*/
*/
public
$lexerOptions
=
[];
public
$lexerOptions
=
[];
/**
/**
* @var \Twig_Environment twig environment object that do all rendering twig templates
* @var \Twig_Environment twig environment object that do all rendering twig templates
*/
*/
public
$twig
;
public
$twig
;
public
function
init
()
public
function
init
()
{
{
$this
->
twig
=
new
\Twig_Environment
(
null
,
array_merge
([
$this
->
twig
=
new
\Twig_Environment
(
null
,
array_merge
([
'cache'
=>
Yii
::
getAlias
(
$this
->
cachePath
),
'cache'
=>
Yii
::
getAlias
(
$this
->
cachePath
),
'charset'
=>
Yii
::
$app
->
charset
,
'charset'
=>
Yii
::
$app
->
charset
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment