Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
API page: http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.....
The examples of form elements reported in the documentation page need to be updated, as they are actually referring to code that doesn't exist in the Drupal version for which they should be. For example, the code reported for the #value form element is the following one, which is supposed to exist in the Node module:
$form['vid'] = array('#type' => 'value', '#value' => $node->vid);
That code is not anymore present in Drupal 8, nor Drupal 7. I searched for $form['vid']
in Drupal 8, and none of the files for the Node module contains a line with that variable.
Comment | File | Size | Author |
---|---|---|---|
#2 | update-snippets-1353538-2.patch | 2.06 KB | apaderno |
Comments
Comment #1
jhodgdonThis file is in the Documentation project, so moving there. Thanks for reporting this!
Comment #2
apadernoThis is a patch that replaces the snippet with the one found in the Comment module.
Is there an easy way to generate the snippet (including the HTML) from code taken from a module?
Comment #3
jhodgdonWe have an issue about generating the Form API reference page from code in Drupal Core:
#100680: [meta] Make API module generate Form API documentation
Meanwhile, thanks for the patch!
Comment #4
jhodgdonTagging so #1421874: [meta] Documentation Issue Queue Cleanup doesn't have to look at API docs issues.
Comment #5
jhodgdonThe Form API reference is going away for Drupal 8. See
#100680-118: [meta] Make API module generate Form API documentation
for details on what will replace it (basically, there will soon be an Elements page on api.drupal.org, linking to the form/render plugins).
So we are now documenting form/render elements and their specific properties on the element classes. See #2486967: [meta] Move/Create Form Element Documentation
and child issues. That is where the usage examples are going. They have been updated, or are being updated, so this is a duplicate.