src/Contao/Event/Subscriber.php
public function initTwig(\ContaoTwigInitializeEvent $event)
    {
        if (!$this->scopeDeterminator->currentScopeIsBackend()) {
            return;
        }

        $contaoTwig  = $event->getContaoTwig();
        $environment = $contaoTwig->getEnvironment();

        $environment->addExtension(new DcGeneralExtension());
    }
public function initTwig(\ContaoTwigInitializeEvent $event)
    {
        if (!$this->scopeDeterminator->currentScopeIsBackend()) {
            return;
        }

        $contaoTwig  = $event->getContaoTwig();
        $environment = $contaoTwig->getEnvironment();

        $environment->addExtension(new DcGeneralExtension());
    }
public function initTwig ( \ ContaoTwigInitializeEvent $ event ) { if ( ! $ this -> scopeDeterminator -> currentScopeIsBackend ( ) ) { return ; } $ contaoTwig = $ event -> getContaoTwig ( ) ; $ environment = $ contaoTwig -> getEnvironment ( ) ; $ environment -> addExtension ( new DcGeneralExtension ( ) ) ; }
Add custom twig extension.

@param \ContaoTwigInitializeEvent $event The event.

@return void
Add custom twig extension .