-
Notifications
You must be signed in to change notification settings - Fork 17
IBX-3035: [Twig] Allowed passing parameters to ibexa render function
#674
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
base: 4.6
Are you sure you want to change the base?
IBX-3035: [Twig] Allowed passing parameters to ibexa render function
#674
Conversation
…ibexa_render Twig function
1bb7be8 to
2a1ab1c
Compare
| ); | ||
| } | ||
|
|
||
| public static function forwardOptionsToFragmentRenderer(MockObject $fragmentRendererMock, MockObject $valueObjectMock, string $renderStrategyClass): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This abstractions is made to avoid cut&paste of code for similar test in RenderLocationStrategyTest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This abstractions is made to avoid cut&paste of code for similar test in RenderLocationStrategyTest
But does it have to be static?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it needs to be static in order for RenderLocationStrategyTest to re-use the method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have now replaced the static method with a trait
| if ($request->attributes->has('viewParametersString')) { | ||
| $uri->attributes['viewParametersString'] = $request->attributes->get('viewParametersString'); | ||
| } | ||
| if ($options['params'] ?? false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please refactor this so you don't rely on true-ish expression inside of the if statement. This works because of implicit cast which can lead to some bugs under some circumstances. What is the real condition making this usable? !is_empty && is_array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have rewritten and simplified the approach. Instead of adding the params parameters in the *FragmentRenders, I have instead fixed it so that the RenderStrategy object instead injects the params parameters into the ControllerReference. This is in line with what happens when render(controller()) is used
| ); | ||
| } | ||
|
|
||
| public static function forwardOptionsToFragmentRenderer(MockObject $fragmentRendererMock, MockObject $valueObjectMock, string $renderStrategyClass): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This abstractions is made to avoid cut&paste of code for similar test in RenderLocationStrategyTest
But does it have to be static?
ibexa render function
… using ibexa_render Twig function
This reverts commit 15bedfa.
2a1ab1c to
8cecc06
Compare
…egy static This reverts commit 15bedfa.
099a520 to
a0ddb17
Compare
a0ddb17 to
988d77f
Compare
|



Description:
When using
render(controller('ibexa_content::viewAction')), you can send parameters to the controller which will be available in the template.Example:
This PR adds the same possibility when using
ibexa_render():For QA:
Documentation: