-
Notifications
You must be signed in to change notification settings - Fork 27
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
EZP-28849: Allow repository forms to use View Manager for handling draft edit controller and template dispatching #215
EZP-28849: Allow repository forms to use View Manager for handling draft edit controller and template dispatching #215
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.
That's the idea, right ! I'll leave the BC to you guys :)
I had a look, and it seems fine to me, besides one point.
The controller action should be empty. If it is not, a developer has to extend from our own controller, and this is what we wanted to avoid, and why viewAction
ended up empty.
The logic in the controller action needs to be moved to the ContentEditViewBuilder
.
{ | ||
/** @var ContentEditView $view */ | ||
$view = $event->getView(); | ||
if (!$view instanceof ContentEditView) { |
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.
Should ContentEditView
inherit from ContentView
? That way, you wouldn't need to reimplement this listener. You can of course have an extra one that does edit specific things.
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 wouldn't mix the two. Hard to predict how someone is going to use ContentView
. In some cases he wouldn't expect to get content editing view. Anyway I also removed ContentEditViewParametersInjectorListener
as it's no longer needed.
dd81e8f
to
a66d7cf
Compare
ping @Nattfarinn @mikadamczyk @ViniTou any chance for code review? |
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.
Commits overlap with #217, AFAICS my review done there applies here as well. Hopefully I didn't miss anything new.
Emphasizing one thing mentioned also in the other PR:
@@ -117,7 +110,7 @@ public function createWithoutDraftAction($contentTypeIdentifier, $language, $par | |||
* @param string $toLanguage | |||
* @param \Symfony\Component\HttpFoundation\Request $request | |||
* | |||
* @return \EzSystems\RepositoryForms\Content\View\ContentCreateDraftView|\Symfony\Component\HttpFoundation\Response | |||
* @return \EzSystems\RepositoryForms\Content\View\ContentCreateDraftView|Response |
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.
There's a lot of inconsistency in PhpDoc type hinting. Please decide to use either FQCN or short name.
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.
To my knowledge, we use fully-qualified namespaces.
While real IDEs will help navigate with short names, you don't get that option when reviewing code on github. I think it's a very valid argument.
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.
Depends on the repository. AdminUI uses short names. Is there a way to enforce it with PHP CS Fixer? @alongosz do you know?
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.
Is there a way to enforce it with PHP CS Fixer?
No, I already looked for it some time ago. Checked just now - nothing changed - we probably would need to contribute... :)
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.
Ok. I've changed to FQCN.
2142110
to
185dc43
Compare
@mikadamczyk @ViniTou @alongosz @Nattfarinn Code review needed. |
@bdunogier Controller won't stay empty because in |
@webhdx actually, you do get the Request with ViewBuilder Filters. It is what I had used when I had prototyped this: https://github.com/ezsystems/repository-forms/pull/62/files#diff-03ff5c01c6c75308bdf76dbeb0596a18. |
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.
Review taken from #217 (I got lost initially due to overlapping commits and posted things there)
* @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException | ||
* @throws \eZ\Publish\Core\Base\Exceptions\BadStateException | ||
* @throws \eZ\Publish\Core\Base\Exceptions\InvalidArgumentException | ||
* @throws \eZ\Publish\Core\Base\Exceptions\UnauthorizedException |
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.
@webhdx please type-hint API
* | ||
* @return \eZ\Publish\API\Repository\Values\Content\Content | ||
* | ||
* @throws \eZ\Publish\Core\Base\Exceptions\InvalidArgumentException |
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.
@webhdx please type-hint API
@@ -0,0 +1,298 @@ | |||
<?php |
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.
Nitpick: missing PhpDoc with license and copyright
185dc43
to
cc1d362
Compare
@alongosz Fixed. |
…aft edit controller and template dispatching
cc1d362
to
4025795
Compare
Description
I heard from @bdunogier it was always the initial idea but no one had time to finish it. As Page Builder is meant to replace edit interface for Landing Pages we need this feature. This PR only affects draft edit action, next one will be dedicated to content create.
I'd like a solid code review as this PR might potentially introduce some BC breaks.
QA Testing
Might be hard to test by QA as this is mostly related to developer experience but I'd advise to get through content editing briefly. If the content editing screen is displayed correctly and the actions are performed as expected it should be alright.