-
Notifications
You must be signed in to change notification settings - Fork 34
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
Use members templates inside my views? #52
Comments
Hi @ppi-buck Hope this helps! |
Hey Aaron, thanks for your response! I actually managed to replace templates just the way you described. What I'm struggling with though is how to use this extension properly inside my project. Right now I'm doing it this way which to me seems kinda 'hacky'... In my Controller I defined some new actions for the different functions of the MembersBundle I need. public function loginAction(Request $request) {
$response = $this->forward('MembersBundle:Auth:login');
$this->view->output = $response->getContent();
}
public function registerAction(Request $request) {
$response = $this->forward('MembersBundle:Registration:register');
$this->view->output = $response->getContent();
} I then return the result to my views and render those out. Doesn't seem right to me since the So if you or anyone else can hint me into the right direction I would really appreciate. Cheers and have a good day! |
closed doe inactivity. |
@ppi-buck have you found a solution? I am facing the same issue. Specifically, I need to:
But I am lost as to how, @solverat? Overriding the templates as mentioned above does not work, as
As there will be missing view variables. I've read up on overriding bundle parts, and tried to decorate
The above mentioned solution of forwarding the requests also seems a bit weird. So, what is the correct, recommended workflow here? This is probably just me lacking Symfony knowledge, but it would be nice to provide example(s) on how to actually integrate |
I'm afraid, but I think you need to invest more time in learning symfony / pimcore principals. Just by adding a folder structure like in the screenshot below, you're able to override every single members template (and extend them of course from your app layout). Overriding controllers should be the final task and is not recommended. Just use one of the plenty events, members comes with: https://github.com/dachcom-digital/pimcore-members/blob/master/docs/40_Events.md. |
Extend forms: Also symfony standard: https://symfony.com/doc/4.4/form/create_form_type_extension.html |
@solverat Thank you for responding, and for the links. Oh, no doubt about that, there is still much for me to learn with Symfony & Pimcore. I am not sure we understand each other though; I do understand how bundle templates overriding works, however when I did what you suggest, created the folder structure as you show here, and extended my app layout, it didn't work. That's because I use my own BaseController where set up many view variables common to all my documents. These are then not available, as the "request processing" still works via "your" (MembersBundle) controllers which – of course – don't extend my BaseController and therefore I get "missing variable" Twig errors. Either way, in the end I solved it by overriding the controllers with my own AppBundle controllers as I couldn't find any other way of doing this. Still, thank you very much for taking the time to respond! |
@jantomicky Then maybe Twig globals might be something for you: https://symfony.com/doc/4.4/templating/global_variables.html |
Thank you @aarongerig, I'll take a look! |
Hey again,
I'm not really that experienced with using twig but I got my site working on twig now because I want to include the templates you provide inside my views like so:
It always throws an error
Variable "form" does not exist.
Is my approach totally wrong? Or am I missing something?My goal is to use the register form/login form etc inside my custom styling.
Thanks in advance
The text was updated successfully, but these errors were encountered: