Thursday 28 November 2013 9:41:14 am - 10 replies
Hi,
I'm building a site using eZ Publish Community Project 2013.9. For the user frontend, I'm relying completly on the symfony stack - i.e., all templates were implemented using Twig.
Unfortunately, the "Preview" function in the admin backend is still rendering the content through the legacy stack. Therefore this preview is not of much use...
Is there a way to let eZ Publish render the preview using the Twig templates?
Thursday 28 November 2013 10:49:42 am
Hi Markus,
yes there is. same way we roughly intend to solve it for next 5.x release.
Setup Symfony to take over the url ( content/versionview/{ObjectID}/{EditVersion}/{LanguageCode}/{FromLanguage} ) and redirect it to a controller similar to the stock content controller in 5.x stack with the difference being selecting a specific version instead, given legacy admin interface uses iframe to front end this should theoretically work.
In reality there probably is a couple of more edge cases and things to take care of then that, but this should already be a big step towards solving the problem without having to change legacy.
Best,
André
Monday 02 December 2013 2:15:57 pm
Hi André, thanks for your reply.
I gave it a try, but it seems that I'm missing something...
There are two issues that I'm fighting at the moment:
* Though the custom route works in my user siteaccess, the admin backend just ignores the symfony2 route and still uses the legacy viewcontroller.
* My custom controller is basically a copy of the eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController class. This class expects injection of a ViewManager object. I've tried adding this to my services.yml:
my.controller.preview:
class: My\CustomBundle\Controller\PreviewController
arguments: [@ezpublish.view_manager]
parent: ezpublish.controller.base
scope: request
But (in the user siteaccess) I always get an exception: "Catchable Fatal Error: Argument 1 passed to My\CustomBundle\Controller\PreviewController::__construct() must be an instance of eZ\Publish\Core\MVC\Symfony\View\Manager, none given"
Could you please give me a hint what I'm missing here?
Monday 02 December 2013 3:41:35 pm
Another approach is to call subrequests into symfony from the legacy stack. We've created a legacy template operator for this:
https://github.com/blendinteractive/blendsubrequest
From an architectural standpoint, this isn't a good solution, but it works well and provides an easy solution until more of the admin is moved to the Symfony stack.
Tuesday 03 December 2013 12:58:18 am
Hi Joe,
I've added your extension, but unfortunately I get a "Operator 'render_controller' is not registered" warning. I regenerated the autoloads array, and the operator class is listed there. Is there anything else I need to do?
Modified on Tuesday 03 December 2013 12:58:59 am by Markus Mahner
Tuesday 03 December 2013 12:19:26 pm
Hi Markus,
I took another look at the code, I'm not sure why it won't work for you. Sounds like you've tried most of this, but as a troubleshooting checklist:
I hope that helps.
Tuesday 03 December 2013 1:31:09 pm
You must be logged in to post messages in this topic!