Skip to content

More fixes about Twig classes namespaces #9997

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions best_practices/templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,16 @@ Markdown content into HTML::
}

Next, create a new Twig extension and define a new filter called ``md2html``
using the ``Twig_SimpleFilter`` class. Inject the newly defined ``markdown``
using the ``Twig\TwigFilter`` class. Inject the newly defined ``markdown``
service in the constructor of the Twig extension::

namespace AppBundle\Twig;

use AppBundle\Utils\Markdown;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;

class AppExtension extends \Twig_Extension
class AppExtension extends AbstractExtension
{
private $parser;

Expand All @@ -131,7 +133,7 @@ service in the constructor of the Twig extension::
public function getFilters()
{
return array(
new \Twig_SimpleFilter(
new TwigFilter(
'md2html',
array($this, 'markdownToHtml'),
array('is_safe' => array('html'), 'pre_escape' => 'html')
Expand Down
1 change: 0 additions & 1 deletion components/form.rst
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ to bootstrap or access Twig and add the :class:`Symfony\\Bridge\\Twig\\Extension
use Symfony\Bridge\Twig\Form\TwigRendererEngine;
use Twig\Environment;
use Twig\Loader\FilesystemLoader;
use Twig\RuntimeLoader\FactoryRuntimeLoader;

// the Twig file that holds all the default markup for rendering forms
// this file comes with TwigBridge
Expand Down
2 changes: 1 addition & 1 deletion service_container.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ security.authorization_checker ``Symfony\Component\Security\Core\Authorization\
security.password_encoder ``Symfony\Component\Security\Core\Encoder\UserPasswordEncoder``
session ``Symfony\Component\HttpFoundation\Session\Session``
translator ``Symfony\Component\Translation\DataCollectorTranslator``
twig ``Twig_Environment``
twig ``Twig\Environment``
validator ``Symfony\Component\Validator\Validator\ValidatorInterface``
=============================== =======================================================================

Expand Down