-
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?
Changes from all commits
c12ad87
dc40058
a2ab75a
c28e4f9
2a1ab1c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,6 +58,10 @@ public function render($uri, Request $request, array $options = []) | |
| if ($request->attributes->has('viewParametersString')) { | ||
| $uri->attributes['viewParametersString'] = $request->attributes->get('viewParametersString'); | ||
| } | ||
| if ($options['params'] ?? false) { | ||
| $uri->attributes['params'] = $options['params']; | ||
| unset($options['params']); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This effectively changes the behavior which we can do in 6.0 ATM. |
||
| } | ||
| } | ||
|
|
||
| return $this->innerRenderer->render($uri, $request, $options); | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -45,7 +45,7 @@ public function render(ValueObject $valueObject, RenderOptions $options): string | |||||
|
|
||||||
| $renderer = $this->getFragmentRenderer($options->get('method', $this->defaultRenderer)); | ||||||
|
|
||||||
| return $renderer->render($controllerReference, $currentRequest)->getContent(); | ||||||
| return $renderer->render($controllerReference, $currentRequest, $options->has('params') ? ['params' => $options->get('params')] : [])->getContent(); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Readability: please split this into multiple lines. Personally I'd just go with:
Suggested change
and would've taken this into the account when processing further, effectively making params always present, reducing cognitive complexity. |
||||||
| } | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
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
ifstatement. 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?