diff --git a/Controller/PageAdminController.php b/Controller/PageAdminController.php index 156eadb6a..302f2c09b 100644 --- a/Controller/PageAdminController.php +++ b/Controller/PageAdminController.php @@ -94,7 +94,15 @@ public function treeAction(Request $request = null) $datagrid = $this->admin->getDatagrid(); $formView = $datagrid->getForm()->createView(); - $this->get('twig')->getExtension('form')->renderer->setTheme($formView, $this->admin->getFilterTheme()); + // NEXT_MAJOR: remove bc check + // BC for Symfony < 3.2 where this runtime does not exist + $twig = $this->get('twig'); + $theme = $this->admin->getFilterTheme(); + if (!method_exists('Symfony\Bridge\Twig\AppVariable', 'getToken')) { + $twig->getExtension('Symfony\Bridge\Twig\Extension\FormExtension')->renderer->setTheme($formView, $theme); + } else { + $twig->getRuntime('Symfony\Bridge\Twig\Form\TwigRenderer')->setTheme($formView, $theme); + } return $this->render($this->admin->getTemplate('tree'), array( 'action' => 'tree', diff --git a/Resources/views/PageAdmin/tree.html.twig b/Resources/views/PageAdmin/tree.html.twig index 2443c54f8..03ef68af8 100644 --- a/Resources/views/PageAdmin/tree.html.twig +++ b/Resources/views/PageAdmin/tree.html.twig @@ -24,8 +24,9 @@ file that was distributed with this source code. {{ 'pages.compose_label'|trans({}, 'SonataPageBundle') }} {% if page.edited %}{{ 'pages.edited_label'|trans({}, 'SonataPageBundle') }}{% endif %} + {% import _self as macro %} {% if page.children|length %} - {{ _self.pages(page.children, admin, false) }} + {{ macro.pages(page.children, admin, false) }} {% endif %} {% endfor %}