Skip to content

Commit 034e139

Browse files
committed
[doc] Add Cookbook chapter
1 parent 0dffb9c commit 034e139

File tree

5 files changed

+16
-40
lines changed

5 files changed

+16
-40
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: php
22

33
php:
4-
- 5.3.3
54
- 5.3
65
- 5.4
76

DependencyInjection/Configuration.php

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -169,39 +169,7 @@ protected function addSmartyOptions(ArrayNodeDefinition $rootNode)
169169
->children()
170170
->scalarNode('allow_php_templates')->end()
171171
->scalarNode('auto_literal')->end()
172-
->arrayNode('autoload_filters')
173-
->info('filters that you wish to load on every template invocation')
174-
->canBeUnset()
175-
->children()
176-
->arrayNode('pre')
177-
->example(array('trim', 'stamp'))
178-
->canBeUnset()
179-
->beforeNormalization()
180-
->ifTrue(function($v){ return !is_array($v); })
181-
->then(function($v){ return array($v); })
182-
->end()
183-
->prototype('scalar')->end()
184-
->end()
185-
->arrayNode('post')
186-
->example(array('add_header_comment'))
187-
->canBeUnset()
188-
->beforeNormalization()
189-
->ifTrue(function($v){ return !is_array($v); })
190-
->then(function($v){ return array($v); })
191-
->end()
192-
->prototype('scalar')->end()
193-
->end()
194-
->arrayNode('output')
195-
->example(array('convert'))
196-
->canBeUnset()
197-
->beforeNormalization()
198-
->ifTrue(function($v){ return !is_array($v); })
199-
->then(function($v){ return array($v); })
200-
->end()
201-
->prototype('scalar')->end()
202-
->end()
203-
->end()
204-
->end()
172+
->scalarNode('autoload_filters')->end()
205173
->scalarNode('cache_dir')->defaultValue('%kernel.cache_dir%/smarty/cache')->cannotBeEmpty()->end()
206174
->scalarNode('cache_id')->end()
207175
->scalarNode('cache_lifetime')->end()
@@ -237,6 +205,7 @@ protected function addSmartyOptions(ArrayNodeDefinition $rootNode)
237205
->scalarNode('plugins_dir')->end()
238206
->scalarNode('smarty_debug_id')->end()
239207
->scalarNode('template_dir')->defaultValue('%kernel.root_dir%/Resources/views')->cannotBeEmpty()->end()
208+
->booleanNode('trim_whitespace')->defaultFalse()->end()
240209
->scalarNode('trusted_dir')->end()
241210
->scalarNode('use_include_path')->defaultFalse()->end()
242211
->scalarNode('use_sub_dirs')->defaultTrue()->end()

Resources/doc/cookbook.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.. index::
2+
single: Cookbook
3+
4+
.. _ch_cookbook:
5+
6+
********
7+
Cookbook
8+
********
9+
10+
Some text

SmartyEngine.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,11 @@ public function __construct(\Smarty $smarty, ContainerInterface $container,
8484
// There are no default extensions.
8585
$this->extensions = array();
8686

87-
foreach (array('autoload_filters') as $property) {
88-
if (isset($options[$property])) {
89-
$this->smarty->$property = $options[$property];
90-
unset($options[$property]);
91-
}
87+
// trim whitespace
88+
if (true === $options['trim_whitespace']) {
89+
$this->smarty->loadFilter('output','trimwhitespace');
9290
}
91+
unset($options['trim_whitespace']);
9392

9493
/**
9594
* @warning If you added template dirs to the Smarty instance prior to

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"smarty/smarty": "3.1.*@stable"
2727
},
2828
"require-dev": {
29-
"symfony/security": "2.1.*",
3029
"symfony/yaml": "2.1.*",
3130
"symfony/assetic-bundle": ">=2.0"
3231
},

0 commit comments

Comments
 (0)