Follow-up of #1892182: #type details: Rename #collapsed to #open (comments #58 and #59) where #collapsible and #collapsed for detail elements is replaced by #open and the default is reversed. Following that idea, some logic and variable naming should be inversed as well.
This is a 3 line change patch for file/class/method core/modules/config_translation/lib/Drupal/config_translation/Form/ConfigTranslationFormBase::buildConfigForm(): where parameter $collapsed should be renamed to $open, including its logic default and thus also including changing calls to it that pass or not pass that option.
| Comment | File | Size | Author |
|---|---|---|---|
| #20 | interdiff-2203021-9-20.txt | 2.08 KB | jorgegc |
| #20 | drupal-rename-to-open-2203021-20.patch | 2.56 KB | jorgegc |
| #16 | interdiff-2203021-9-16.txt | 1.44 KB | jorgegc |
| #16 | drupal-rename-to-open-2203021-16.patch | 3.12 KB | jorgegc |
| #9 | drupal-rename-to-open-2203021-9.patch | 2.65 KB | mandar.harkare |
Comments
Comment #1
sunSlightly more sane issue title ;)
+ postponing on parent issue.
Comment #2
mandar.harkare commentedComment #3
fietserwinThanks for posting the patch. A few remarks though
This issue is slightly more than a simple rename, as we also inverse the meaning of the parameter. So either:
- the default should become TRUE
- the default remains FALSE, as is the default for the open attribute in a details element. So I suggest to use this case.
But then:
- in the former case, the default behavior does not change and we only must change calls to this method that do pass in a value for this parameter.
- in the latter case, the default behavior changes also and thus must we change all calls to this method.
It is a protected method and only 2 sub classes call this method, so it won't be to difficult to find these calls and cahnge those lines as well (change: true => false, false => true, expression => !expression).
This will need to be rerolled once the parent issue gets in, as the parent issue changes this line to '#open'=> !$collapsed,
Comment #4
fietserwinParent issue is in. Above patch is not yet OK. Setting to Needs Work.
Comment #5
mandar.harkare commentedNot sure if the first call needs to add the TRUE parameter, adding it though.
Comment #6
mandar.harkare commentedPlease review it.
Comment #8
fietserwinThe contents of the patch from #5 is correct, but needs to be combined with the contents of the patch in #2. Both together will give us a patch that will fix this issue.
Comment #9
mandar.harkare commentedComment #10
fietserwinThis is how it should be. Good to go.
Comment #11
tstoecklerThanks for working on this patch, looks great but for one minor detail.
This is fairly minor, but sending back to "needs review" to see what people think:
Shouldn't we change the default value to "TRUE" instead?
Comment #12
fietserwin- The default for a details element is to be closed, so that wold suggest $open = false.
- OTOH, this (protected) function is called twice, once outside this function and once recursively inside this function. With this new default, both calls now have to pass in a value, so the default value for this parameter can even be removed. It even looks like the last 2 parameters were for "internal use" only. So that would suggest $open= true.
I have no clear opinion on this, so I will RTBC both ways.
@mandar.harkare: if you can post another patch with $open= TRUE, anyone with a clear preference can choose :)
Comment #13
lhangea commentedComment #14
alexpottI have a clear preference for reversing the default since we've reversed all the other logic.
Comment #15
jorgegc commentedI am going to work on a patch to address #14.
Comment #16
jorgegc commentedThis was my first core patch, I think the next step is getting a review and seeing what the testbot results are.
I've basically reversed the default and updated the PHPDoc accordingly.
Comment #17
alexpottThis change can now be reverted since TRUE is the default
Comment #18
tstoeckler@jorgegc: Wow, nice job for your first patch!!! Maybe you can fix these minor issues and then we can set this to RTBC?!
"Flag to set collapsed state" is sort of not wrong, but "Defaults to TRUE" implies that it defaults to collapsed, while it defaults to open. Maybe something like:
"Whether or not the details element of the form should be open. Defaults to TRUE."
Edit: Fix broken markup.
Comment #19
jorgegc commentedThe work was done by @mandar.harkare, I am just making some small changes :-) Thanks for the feedback guys, I will redo my patch and interdiff.
Comment #20
jorgegc commentedJust uploaded a patch and an interdiff to implement changes requested in #17 and #18.
Comment #21
jorgegc commentedCould you guys please review?
Comment #22
fietserwin#18: good catch.
RTBC, under the assumption that the testbot can apply it and all tests still succeed.
Comment #23
tstoecklerAwesome, thanks for the quick turnaround. RTBC++
Comment #24
alexpottCommitted f658a90 and pushed to 8.x. Thanks!