Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
documentation
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
11 May 2015 at 20:51 UTC
Updated:
23 Sep 2015 at 13:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
metzlerd commentedComment #2
metzlerd commentedComment #3
metzlerd commentedComment #4
metzlerd commentedComment #5
metzlerd commentedBack from summer vacation and starting to work on this.
Comment #6
metzlerd commentedWhile working through this. I discovered that the only difference between a fieldgroup and a fieldset is that a fieldgroup has a class on it. Fieldgroups are used exactly 4 times in core, and only in the drupal installation screens. This kind of begs the question as to whether the fieldgroup makes sense to keep and or document? Do people have thoughts on this?
Comment #7
jhodgdonWell, it is probably too late in the development cycle to remove the Fieldgroup element, so I guess we are stuck documenting it.
Comment #8
tim.plunkettWe do the same with
'#type' => 'operations'vs'#type' => 'dropbutton'. \Drupal\Core\Render\Element\Operations extends Dropbutton, for only minor differences.That's not really an answer, sorry, just pointing out it's not the only mostly-useless render element around.
Comment #9
metzlerd commentedDo you think it deserves its own usage example or should we just add:
It seems we'd want to make sure people understood which was the not mostly-useless derivation and which is the base class.
Comment #10
metzlerd commentedHere is the first stab. I ran into some problems with the vertical tabs elements. Documentation says that it expects fieldsets, but looking at actual uses and my own internal testing suggests that it only works with details elements (which are new to drupal 8). Also, although I read in the code that #default_tab should work, it appears to not work as designed. I'm guessing we should file another issue with regard to that?
I did the fieldgroup as a straight copy of the fieldset for now... not sure I like it but am waiting to hear what others think.
Comment #11
metzlerd commentedComment #12
jhodgdonLooks pretty good! A few minor things to clear up:
This is confusing. There are two things:
a) Naming the form array key 'actions'
b) Using #type => 'actions'
And there are two effects. I think (a) leads to "other modules can alter", and (b) leads to "proper styling". Right?
So let's separate this into two sentences.
Also I think it would make sense here and in the other "grouping" elements, to have a statement like:
To group elements, define the parent element, and put each child element as a nested array inside the parent.
This can possibly be worded better... I guess the usage examples imply this, but it probably wouldn't hurt to state it?
Would someone normally use Container itself, or one of the other container elements (fieldset, details, etc.)?
Maybe above this, we should put the word "generic" in the docs somewhere, and note that normally you would use one of the more specific container elements? Not sure...
Nitpick: Both of these bullet items should end in .
Also do you think "should be visible" should maybe say something like "should start out as visible" or something like that? Because when I see "should be visible" when the property is "#open"... it makes me a bit confused.
Will this work, or does it need to be array($this, '::submitCacheClear') instead of just '::submitCacheClear' ?
Should we add a note here saying "Normally, use a ... "?
Missing the "Usage example:" heading.
I was very confused about why the array key here was 'name'?
We don't have ... in any of the other examples. Probably shouldn't have it here either?
Should we add a note here saying "Normally, use a ... "?
See review notes on the Fieldgroup... Also yes I think we should only have the example once. So whichever one is the silly one, let's put "Normally, use a .... See ... for documentation and usage." in there, and then just have the docs in the normally used one.
Here I think it would be better to say:
An array of the rows to be displayed. Within each row, the cells are ....
Because I think this can actually be fairly complicated... See
https://api.drupal.org/api/drupal/core!modules!system!templates!table.ht...
Probably we should link to this documentation?
Also, nitpick: should only be one space after .
If they are specifying it as child elements, in what order (rows, then within that columns, or vice versa)?
Nitpick: Two spaces after . should only be 1
Typo: Properties
Nitpick: id => ID
Also this should end in .
And ...needs to tell how someone would know what the ID is. It is not obvious to me. It seems like, from the example, that it is the HTML ID attribute of the tab, but how would someone know what that ID would be? Doesn't it depend on the theme? Ugh.
Comment #13
metzlerd commentedThanks as always for the thorough review, I am working on implementing the changes, but in thinking about 1.) I'm not so sure I agree with your statement. The way I as a developer use the $form['actions'] element is so that I can add use hook_form_alter to add an extra submit button to a form kind of like this:
The fact that other developers use the id actions consistently makes my form_alter code cleaner. It is this case that I think the original author is talking about. Can you think of anything to make that clearer? I'm currently thinking about something like:
I did verify there is css in core that references "#actions-edit" input to do element styling.
Comment #14
jhodgdonThat looks perfect to me, aside from a bit of awkward grammar. :) How about:
Use of a single Actions element with an array key of 'actions' to group the
primary submit buttons on a form helps to ensure proper styling
in themes, and enables other modules to properly alter a form's actions.
[slight change to last line]
Comment #15
metzlerd commentedHere's the next take some notes:
Re: Container: I did some searching in drupal core for the use of containers and found several of them. I revised my example based on what I found. I'm wondering whether I need to document all the #state stuff which I didn't know about until today. It is a very powerful tool that I didn't know existed. Leads me to wonder where this should be documented.
Re: Details: The array('::submitForm') syntax for submit does work. That example was from the clear cache code in core. I removed it since that would best be dealt with in Submit documentation anyway and went to a more "fake" example.
Re: Fieldset vs. FieldGroup: I reworked to drive people to fieldset usage. The original code was from views somewhere, so I reworked it to something more generic.
Re: Tables: My testing showed that simple rows of column content worked, so I want to document that (which isn't in template docs) so I tried to address that let me know if you think it sounds awkward.
Re: Vertical Tabs: Yes HTML ID's are what's required. A gave a stab at addressing the concerns, but yeah it would be theme dependent if the theme mucked with the way id's are generated (hopefully not).
Comment #16
jhodgdonLooks really good!
A few very minor things to fix and I think we're good to go:
spelling error: should be accommodation
nitpick: One space too many indentation in 2nd line here.
Hm. So the details element docs above say it can be used outside of forms, but this example contains a form field. I guess that is OK, but maybe it would make sense to create an example that just has some markup in it rather than a form field?
...
OK I got to the end of the patch and came back here, because I found out that you might need to use details in a form for a vertical tabs element. So I guess the example can stay as it is.
I think it would be good to have an @see to the vertical tabs element here though?
This line should be removed, and I suppose also the blank line above it. Got left in by mistake in the last revision I guess. :)
Doesn't this "Alternatively" part go with #rows rather than #empty?
html -> HTML
Comment #17
metzlerd commentedHere's back at ya.
Comment #18
jhodgdonAlmost there! Not quite everything from the last review got fixed:
I think we should also correct the spelling in the array keys and classes in this section
accomodation -> accommodation
This still needs to be removed.
Comment #19
metzlerd commentedVery sorry... guess I shouldn't have rushed this in before heading off to work ;)
Comment #20
jhodgdonStill two one-m misspellings:
Comment #21
metzlerd commentedOne more time with feeling!
Comment #22
jhodgdonThis sentence doesn't end in a . but ... not sure API module would turn table.html.twig into a link if it were... probably OK as-is.
So, this is looking great!
Comment #23
alexpottCommitted 8b2e3f0 and pushed to 8.0.x. Thanks!
Comment #25
jhodgdonWoot! Looks like the parent issue just has 2 more children: "hidden" things and "button" things.