Jump to:
| Project: | API |
| Version: | 6.x-1.x-dev |
| Component: | Other |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (duplicate) |
Issue Summary
The Forms API reference on api.drupal.org is one of a few files left in Drupal 7 in the contrib repository that is displayed there.
It's almost impossible to keep up to date.
It would be great if at least part of its functionality could be generated automatically from the API module. Important functionality:
- List of all the elements, with descriptions and a list of their properties (with internal links).
- List of all the properties, with descriptions and a list of the elements that use them (with internal links).
- Table listing which properties apply to which elements.
This wouldn't have to all be on one page.
An outline of how this could work:
- Parse hook_element_info() implementations. This would generate a list of the elements defined in core, as well as the process, after_build, and other associated functions.
- Be aware of the standard properties that apply to every element, such as #process.
- A hard part: Parse, somehow, the processing and theme callbacks to discover other properties. This is what I had to do manually the last time I updated the forms reference -- looking through these callback functions to see which properties were being used by various functions for various elements.
- Another hard part: Generate links to the element's documentation when a function builds a form. And generate a list of functions that use a given form element, along with the element documentation.
To make this work, we'd need a way to add:
- Documentation for each element -- perhaps a special docblock inside hook_element_info() that would tell the API module the documentation for that element type, and which could include a usage example.
- Documentation for each property -- I'm not sure where that would go, but we'd need a way to document #title, #value, etc. and include examples.
Comments
#1
Whoops, I didn't see this other issue -- this one is a duplicate:
#100680: Automatically generate Forms API & other big array documentation