Skip to content

Commit

Permalink
merged branch stof/twig_provider_length (PR silexphp#360)
Browse files Browse the repository at this point in the history
Commits
-------

8ccf217 Removed the aliases for classes

Discussion
----------

Removed the aliases for classes

They are no longer needed as there is no conflict anymore with the
silex providers since their renaming. And changing the length of the
file fixes silexphp#359
  • Loading branch information
fabpot committed Jun 13, 2012
2 parents 550dbbe + 8ccf217 commit 1e5452b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Silex/Provider/TwigServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
use Silex\Application;
use Silex\ServiceProviderInterface;

use Symfony\Bridge\Twig\Extension\RoutingExtension as TwigRoutingExtension;
use Symfony\Bridge\Twig\Extension\TranslationExtension as TwigTranslationExtension;
use Symfony\Bridge\Twig\Extension\FormExtension as TwigFormExtension;
use Symfony\Bridge\Twig\Extension\SecurityExtension as TwigSecurityExtension;
use Symfony\Bridge\Twig\Extension\RoutingExtension;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Bridge\Twig\Extension\FormExtension;
use Symfony\Bridge\Twig\Extension\SecurityExtension;

/**
* Twig integration for Silex.
Expand Down Expand Up @@ -48,23 +48,23 @@ public function register(Application $app)

if (class_exists('Symfony\Bridge\Twig\Extension\RoutingExtension')) {
if (isset($app['url_generator'])) {
$twig->addExtension(new TwigRoutingExtension($app['url_generator']));
$twig->addExtension(new RoutingExtension($app['url_generator']));
}

if (isset($app['translator'])) {
$twig->addExtension(new TwigTranslationExtension($app['translator']));
$twig->addExtension(new TranslationExtension($app['translator']));
}

if (isset($app['security.context'])) {
$twig->addExtension(new TwigSecurityExtension($app['security.context']));
$twig->addExtension(new SecurityExtension($app['security.context']));
}

if (isset($app['form.factory'])) {
if (!isset($app['twig.form.templates'])) {
$app['twig.form.templates'] = array('form_div_layout.html.twig');
}

$twig->addExtension(new TwigFormExtension($app['form.csrf_provider'], $app['twig.form.templates']));
$twig->addExtension(new FormExtension($app['form.csrf_provider'], $app['twig.form.templates']));

// add loader for Symfony built-in form templates
$reflected = new \ReflectionClass('Symfony\Bridge\Twig\Extension\FormExtension');
Expand Down

0 comments on commit 1e5452b

Please sign in to comment.