-
Notifications
You must be signed in to change notification settings - Fork 13
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
IBX-6630: Allowed injecting view type into content preview controller #285
Conversation
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.
Aside remarks from @Steveb-p
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.
Apart from Paweł's comments which I agree with.
69af4ff
to
64a8857
Compare
tests/lib/MVC/Symfony/Controller/Controller/Content/PreviewControllerTest.php
Outdated
Show resolved
Hide resolved
@@ -161,7 +161,7 @@ protected function getForwardRequest(Location $location, Content $content, SiteA | |||
], | |||
'location' => $location, | |||
'content' => $content, | |||
'viewType' => ViewManagerInterface::VIEW_TYPE_FULL, | |||
'viewType' => $viewType, |
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.
Out of curiosity, do we even need to be aware of the defaults both here and in the caller? Doesn't admin UI fall back into a full view on it's own? If so, you might want to remove the default and just pass null
.
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.
Out of curiosity, do we even need to be aware of the defaults both here and in the caller? Doesn't admin UI fall back into a full view on it's own? If so, you might want to remove the default and just pass
null
.
viewType is a core concept. Even if somehow AdminUI does this on its own, this would be a break in core behavior for anyone directly using that controller. While there's no BC promise on that, since the class is neither final nor internal, this is very low cost to at least try keeping that BC.
a5154fe
to
37f1de0
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Merging to unblock a lot of other dependent Pull Requests. Will be sent to QA with Dashboard feature when ready. For now performed some manual tests to make sure it doesn't break anything. |
v4.6
This PR allows passing optional
{viewType}
route attributequery parameter for core content preview controller (ibexa.controller.content.preview:previewContentAction
).Preview Controller builds parameters for
ViewController::viewAction
and forwards request to that controller. It seemsfull
view type is hardcoded there. Till now it was enough because type of template for preview was based solely on a SiteAccess and the same was used both for view and preview.However, there are some cases, like back-office customizable Dashboard when we have 2 types of content views needed: regular AdminUI content/location view and the actual dashboard page preview also displayed in the context of admin SiteAccess. This enhancement adds more flexibility to other use cases apart from closed-source Dashboard.
Update
For a good beginning of the weekend, I refactored
PreviewControllerTest
to actually test what it's supposed to test, in a more compact and modern way. I recommend either reviewing the whole test class or just the diff for the test of the essence of the current changes (6ed7e4e).TODO
\Ibexa\Tests\Core\MVC\Symfony\Controller\Controller\Content\PreviewControllerTest
.Checklist:
$ composer fix-cs
).