Problem/Motivation
- Begginers at Drupal (such as myself) find it very hard to find information on how to properly apply in code and find detailed information on Form Elements and Render Elements. Most of the time we have to outsource to Stack Overflow and similar websites to find what we are looking for.
Proposed resolution
- Improve the Classes documentation found in Form and render elements to make them more detailed about properties and attributes;
- Improve Form render elements and/or Form API;
Remaining tasks
- [x] Decide on the scope of the issue, improve @docblocks and/or Form API guide;
- Both will be improved;
- [x] Decide on the Documentation template, we worked on this Google Doc:
- The template proposed it is the one to be used on @docblocks;
- [x] Decide where the guides will be placed inside the Wiki;
- [x] Create another [Meta] issue to keep track of each element improvement;
- [ ] Map other issues related to this in the comments, validate if they are truly related and link them as child to this issue;
All issues related to improving documentation of Render elements are being tracked in this spreadsheet.
Comments
Comment #2
amber himes matzThanks for creating this issue!
We've been discussing this in #documentation. Here's a summary of what ideas we have for improving the Form API documentation in its various forms.
For others involved in the discussion, is this a good summary? Anything missing?
I propose that this issue focus on the following:
Comment #3
quietone commentedHow does #3, in the first section, relate to the existing page, Form Render Elements?
I'd like #4 to be done, not 'should' be done. The API documentation should be the source of truth and then the wiki pages can be more about use cases and examples. I don't know is in the core queue for improving the documentation for forms and elements but I'll take a look sometime this week.
Comment #4
gersonjlComment #5
gersonjlRegarding the scope of the issue, I think we should work on both on Form API guide and @docblocks.
I'll also do some research on existing issues and link them to the summary if I find.
I would also like to propose that me and some colleagues already start gathering the data necessary for improving the @docblocks, since it seems to be a consensus that it should be improved.
Comment #6
gersonjlComment #7
gersonjlComment #8
gersonjlI see there are a lot of Form API reference issues from Drupal 7, those shouldn't be considered, right?
Comment #9
amber himes matz@GersonJL, I assume you mean “Form API reference” issues from Drupal 7, correct, we only want to focus on Drupal 8+ Form API issues. You can apply a Drupal version filter in your issue search to only search for Drupal 8, 9, 10 issues. Feel free to ask further questions about using the searching the issue queue in the #documentation channel.
Comment #10
amber himes matzThere will be a Slack-only meeting about this plan in the Drupal Slack #documentation channel this Thursday, Oct 13, 2022 at 18:00 UTC.
https://drupal.slack.com/archives/C220WV2TW/p1665521616666759
https://www.timeanddate.com/worldclock/meetingdetails.html?year=2022&mon...
Comment #11
gersonjlHere are some related issues I found these past few days:
Comment #12
gersonjlComment #13
eojthebraveThis is a great idea. Thanks for working on it.
There's also an existing Render API guide, and personally I think it makes the most sense for the documentation about render elements, both form and markup, to be there. Maybe the template for the page could contain some kind of consistent visual indicator that lets you know the element you're currently looking at is a Form element and will only work in the $form.
We could create a new Render Element's section in the Render API guide. Example:
Render API
- Render Elements
-- What are Render Elements?
-- Actions
-- Ajax
-- Button (FormElement)
-- ...
-- View
-- Weight
-- Define a Custom Render Element
And then the Form API Render Element docs could be updated to point to those new pages, explain that form arrays are a superset of render arrays, and provide examples how render elements are used in a form. Or something like that.
Comment #14
gersonjlComment #15
gersonjlThanks for the suggestion @eojthebrave, we were discussing this yesterday on the Slack meeting, but we didn't end up in a conclusion. I think it's a great idea to build it like that. If anyone isn't opposed to this, I propose we adopt this way to put the new documentation on the Wiki.
Comment #16
gersonjlComment #17
amber himes matzAs we've discussed in the Slack #documentation channel, I think we want to keep the scope of this to just Render Elements (which includes Form Elements). Updating the title accordingly.
Comment #18
gersonjlCreated a spreadsheet to keep track of all the Render elements documentation improvement issues.
Comment #19
adaucyjComment #20
adaucyjComment #21
gersonjlComment #22
gersonjlComment #23
avpadernoComment #24
brad.bulger commentedThis page used to be a useful partial list of element types
Form and render elements - 9.5.x - drupal
https://api.drupal.org/api/drupal/elements/9
But in version 10 it is reduced to one type, Component. Version 11 splurges on two types, Component and Ajax.
If there was some kind of link to some other place to find the information that would be one thing. This is subpar.
Comment #25
liam morlandFor me, the most important missing documentation is that we need a Drupal 10/11 version of the Drupal 7 "Form API Reference" page. Perhaps this is done as more than one page, but somewhere there needs to be list of valid values for
#typeand a way to find out what properties can be used with each type.Comment #26
quietone commentedThe link to the template in the issue summary is a 404.
Comment #27
quietone commentedRelated issues are in the sidebar