bundles/BlockManagerBundle/EventListener/BlockView/GetTwigBlockContentListener.php
public function onRenderView(CollectViewParametersEvent $event): void
    {
        $view = $event->getView();
        if (!$view instanceof BlockViewInterface) {
            return;
        }

        $block = $view->getBlock();
        $blockDefinition = $block->getDefinition();

        if (!$blockDefinition instanceof TwigBlockDefinitionInterface) {
            return;
        }

        $twigContent = $this->getTwigBlockContent(
            $blockDefinition,
            $block,
            $view->getParameters()
        );

        $event->addParameter('twig_content', $twigContent);
    }
public function onRenderView(CollectViewParametersEvent $event): void
    {
        $view = $event->getView();
        if (!$view instanceof BlockViewInterface) {
            return;
        }

        $block = $view->getBlock();
        $blockDefinition = $block->getDefinition();

        if (!$blockDefinition instanceof TwigBlockDefinitionInterface) {
            return;
        }

        $twigContent = $this->getTwigBlockContent(
            $blockDefinition,
            $block,
            $view->getParameters()
        );

        $event->addParameter('twig_content', $twigContent);
    }
public function onRenderView ( CollectViewParametersEvent $ event ) : void { $ view = $ event -> getView ( ) ; if ( ! $ view instanceof BlockViewInterface ) { return ; } $ block = $ view -> getBlock ( ) ; $ blockDefinition = $ block -> getDefinition ( ) ; if ( ! $ blockDefinition instanceof TwigBlockDefinitionInterface ) { return ; } $ twigContent = $ this -> getTwigBlockContent ( $ blockDefinition , $ block , $ view -> getParameters ( ) ) ; $ event -> addParameter ( 'twig_content' , $ twigContent ) ; }
Adds a parameter to the view with the Twig block content.
Adds a parameter to the view with the Twig block content .