[TwigBundle] removed @ when defining an autoescaping service, and fixed XSD to use - instead of _
This commit is contained in:
parent
898a63c8f0
commit
46ac2f0e42
@ -4,7 +4,7 @@ CHANGELOG
|
|||||||
2.3.0
|
2.3.0
|
||||||
-----
|
-----
|
||||||
|
|
||||||
* added option to configure a custom template escaping guesser
|
* added option to configure a custom template escaping guesser (via `autoescape_service` and `autoescape_service_method`)
|
||||||
|
|
||||||
2.2.0
|
2.2.0
|
||||||
-----
|
-----
|
||||||
|
@ -108,13 +108,10 @@ class TwigExtension extends Extension
|
|||||||
$container->setAlias('debug.templating.engine.twig', 'templating.engine.twig');
|
$container->setAlias('debug.templating.engine.twig', 'templating.engine.twig');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($config['autoescape_service']) && 0 === strpos($config['autoescape_service'], '@') && isset($config['autoescape_service_method'])) {
|
if (isset($config['autoescape_service']) && isset($config['autoescape_service_method'])) {
|
||||||
$container->findDefinition('templating.engine.twig')->addMethodCall('setDefaultEscapingStrategy', array(array(new Reference(substr($config['autoescape_service'], 1)), $config['autoescape_service_method'])));
|
$container->findDefinition('templating.engine.twig')->addMethodCall('setDefaultEscapingStrategy', array(array(new Reference($config['autoescape_service']), $config['autoescape_service_method'])));
|
||||||
|
|
||||||
unset(
|
unset($config['autoescape_service'], $config['autoescape_service_method']);
|
||||||
$config['autoescape_service'],
|
|
||||||
$config['autoescape_service_method']
|
|
||||||
);
|
|
||||||
} elseif (!isset($config['autoescape'])) {
|
} elseif (!isset($config['autoescape'])) {
|
||||||
$container->findDefinition('templating.engine.twig')->addMethodCall('setDefaultEscapingStrategy', array(array(new Reference('templating.engine.twig'), 'guessDefaultEscapingStrategy')));
|
$container->findDefinition('templating.engine.twig')->addMethodCall('setDefaultEscapingStrategy', array(array(new Reference('templating.engine.twig'), 'guessDefaultEscapingStrategy')));
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
<xsd:attribute name="auto-reload" type="xsd:string" />
|
<xsd:attribute name="auto-reload" type="xsd:string" />
|
||||||
<xsd:attribute name="autoescape" type="xsd:string" />
|
<xsd:attribute name="autoescape" type="xsd:string" />
|
||||||
<xsd:attribute name="autoescape_service" type="xsd:string" />
|
<xsd:attribute name="autoescape-service" type="xsd:string" />
|
||||||
<xsd:attribute name="autoescape_service_method" type="xsd:string" />
|
<xsd:attribute name="autoescape-service-method" type="xsd:string" />
|
||||||
<xsd:attribute name="base-template-class" type="xsd:string" />
|
<xsd:attribute name="base-template-class" type="xsd:string" />
|
||||||
<xsd:attribute name="cache" type="xsd:string" />
|
<xsd:attribute name="cache" type="xsd:string" />
|
||||||
<xsd:attribute name="charset" type="xsd:string" />
|
<xsd:attribute name="charset" type="xsd:string" />
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$container->loadFromExtension('twig', array(
|
$container->loadFromExtension('twig', array(
|
||||||
'autoescape_service' => '@my_project.some_bundle.template_escaping_guesser',
|
'autoescape_service' => 'my_project.some_bundle.template_escaping_guesser',
|
||||||
'autoescape_service_method' => 'guess',
|
'autoescape_service_method' => 'guess',
|
||||||
));
|
));
|
||||||
|
@ -6,5 +6,5 @@
|
|||||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
||||||
http://symfony.com/schema/dic/twig http://symfony.com/schema/dic/twig/twig-1.0.xsd">
|
http://symfony.com/schema/dic/twig http://symfony.com/schema/dic/twig/twig-1.0.xsd">
|
||||||
|
|
||||||
<twig:config autoescape_service="@my_project.some_bundle.template_escaping_guesser" autoescape_service_method="guess" />
|
<twig:config autoescape-service="my_project.some_bundle.template_escaping_guesser" autoescape-service-method="guess" />
|
||||||
</container>
|
</container>
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
twig:
|
twig:
|
||||||
autoescape_service: @my_project.some_bundle.template_escaping_guesser
|
autoescape_service: my_project.some_bundle.template_escaping_guesser
|
||||||
autoescape_service_method: guess
|
autoescape_service_method: guess
|
||||||
|
Reference in New Issue
Block a user