Updating API documentation
This document covers updating the API documentation at http://api.drupal.org/.
Code
All documentation for core functions, constants, and files are automatically generated from the core modules in Drupal. For example:
- http://api.drupal.org/api/5/constant/DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE
- http://api.drupal.org/api/5/function/node_load
- http://api.drupal.org/api/5/file/modules/book/book.module
To update these, you must submit a core patch to edit the Doxygen comments of the code in question.
Hooks and other references
In addition to core code documentation, there are also manually created and maintained reference documents for things such as hook definitions, Form API documentation, and example module code. For example:
- http://api.drupal.org/api/5/function/hook_install
- http://api.drupal.org/api/5/file/developer/topics/forms_api_reference.ht...
- http://api.drupal.org/api/5/file/developer/examples/filter_example.modul...
You can also review these files online with viewcvs.
Reporting an error
Anyone with a CVS account can edit these additional reference documents. For minor edits, such as fixing typos or blatant errors, feel free to commit changes directly.
For bigger changes, or if you do not have a CVS account, create a Documentation issue select the Documentation in CVS component. It is important to always create an issue, attached a patch, and include a reference to the issue in the commit message when making significant changes so that other developers can understand what was done and why. In other words, follow the same practives you would follow for committing code to CVS.
Fixing an error
To modify the CVS documentation directly, use the following steps. You can refer to the CVS section of the handbook for more information about using CVS. It is important to remember to make your changes in each version of the documentation that needs it!
- From the command line, perform a cvs checkout using your CVS account's username in place of "username" below. This will checkout a copy of the HEAD documentation:
cvs -z6 -d:pserver:username@cvs.drupal.org:/cvs/drupal-contrib checkout -d docs contributions/docs/developer
To checkout the other versions you need to edit you simply modify the command with the version and make sure you place it in a different local directory, for example:
cvs -z6 -d:pserver:username@cvs.drupal.org:/cvs/drupal-contrib checkout -d docs5 -r DRUPAL-5 contributions/docs/developer
You would replaceDRUPAL-5withDRUPAL-4-7for 4.7. - Enter your CVS password when prompted
- You will need to locate the document you need to edit:
- The Form API quickstart (forms_api.html) and reference table (forms_api_reference.html) are in the "topics" folder.
- The hooks documentation is in the "hooks" folder. The particular file will depend upon the hook. If you look at the API page for a hook you will see the source document listed at the top under Description (e.g. developer/hooks/core.php, line 507)
- Any example code that has _example in the name is located in the "examples" folder.
- Once you have saved your changes, commit them:
cvs commit -m "Put a meaningful message about what you did here. Also refer to an issue number with a # symbol if one exists (e.g. #112233) and give credit to users who may have provided a patch."
