-
-
Notifications
You must be signed in to change notification settings - Fork 810
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
[3.4] Allow for consecutive prefills. #6919
Conversation
src/Controller/Backend/General.php
Outdated
@@ -197,15 +197,17 @@ public function prefill(Request $request) | |||
|
|||
if ($request->isMethod('POST') || $request->query->getBoolean('force')) { | |||
$form->handleRequest($request); | |||
if ($form->get('contenttypes')->has('contenttypes')) { | |||
if (!empty($form->get('contenttypes')->getData())) { |
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.
Friends don't let friends use empty()
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.
It returns []
when nothing is selected. Open to suggestions on how to do it properly.
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.
The negation will work for an empty array, however after running though xdebug it returns an [0]
which won't pass negation, but checking Symfony docs when the field type is ChoiceType
and multiple
is true, and expand
is true it should return an empty array … that isn't empty to me … so for now your empty()
wins as a solution to getting this over the line. Just unsure as to what that line is.
So we are or we are not allowing this? That is why the force was there. |
The 'force' is for a slightly different usecase. If you're on a fresh install with no content, it shows the blue bar: This link has the |
48ff97b
to
440a71b
Compare
* | ||
* @return null | ||
*/ | ||
public function build(array $contentTypeNames, $count) | ||
public function build(array $contentTypeNames, $count, $skipNonEmpty) |
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 is a BC break (as shown by the tests)
Given your coming back online from a couple of weeks away, RL work is going to want all of your attention, I'll pick this up and get it over the line for you. |
I though about cheating, and changing it to:
, but that would obviously not be the right way to go. If you have time, fixing it would be much appreciated. If not, i'll make time in the next few days. :-) |
Yeah, I am making time … there is a legitimate problem to be fixed here, this PR goes most of the way to fixing it, and I really don't want to delay this beta any longer than needed. |
…after a completed DB check
- Use a counter for each ContentType loop - Rename variable and set a default to not break BC - Simplify logic and don't double-tap the get() - Kick the logic out of the nest … time to fly - Invert logic - Comment logic on of the approach
440a71b
to
4bb508f
Compare
There we go … passes tests, and no BC breaks. |
$form->get('contenttypes')->has('contenttypes')
Fixes #6917.