Skip to content

Commit 5d14175

Browse files
committed
Document public static methods for Twig view
1 parent 16cc0bf commit 5d14175

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

Views/README.markdown

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,37 @@ library. You can use the Twig custom view in your Slim Framework application lik
1717
If you are not using Composer to autoload project dependencies, you must also set the Twig view's public static
1818
`$twigDirectory` property; this is the relative or absolute path to the directory that conatins the Twig library.
1919

20-
You may also set the public static `$twigOptions` property; this is an array of settings that customize the Twig
21-
library behavior.
20+
### Twig configuration
21+
22+
There are several public static properties you can use to customize the Twig library behavior.
23+
24+
####$twigOptions
25+
26+
An array of options to pass to the underlying Twig environment ([Twig docs](http://twig.sensiolabs.org/doc/api.html#environment-options)):
27+
28+
\Slim\Extras\Views\Twig::$twigOptions = array(
29+
'debug' => true
30+
);
31+
32+
33+
####$twigExtensions
34+
35+
An array contianing Twig extensions to load ([Twig docs](http://twig.sensiolabs.org/doc/advanced.html)):
36+
37+
\Slim\Extras\Views\Twig::$twigExtensions = array(
38+
new MyCustomExtension(),
39+
new ThirdPartyExtension()
40+
);
41+
42+
43+
####$twigTemplateDirs
44+
45+
An array of paths to directories containing Twig templates ([Twig docs](http://twig.sensiolabs.org/doc/api.html#twig-loader-filesystem)):
46+
47+
\Slim\Extras\Views\Twig::$twigTemplateDirs = array(
48+
realpath(PROJECT_DIR . '/templates'),
49+
realpath(PROJECT_DIR . '/some/other/templates')
50+
);
2251

2352
## Mustache
2453

0 commit comments

Comments
 (0)