Posted this yesterday to the forum and got a suggestion to post it here instead to get more attention from the developers:

I've been dealing quite a lot with the Drupal API, and thought to finally open my mouth about something that has bugged me ever since the start.

Why aren't there example code snippets and a comment possibility, similar to what php.net has? At least for me programming gets a LOT easier when you can start modifying existing code instead of looking carefully at the existing documentation and trying to create something from scratch. Besides, code examples always give a really fast and nice approach to "what can you do with this function".

What do you think? I really don't see any downsides in this solution. When coding PHP, the examples and comments give me at least as much information as the API part itself. In my opinion this would make module development significantly easier and with time it'd probably lead to Drupal being even more popular.

In addition, I had to put this issue pointing to component "other" since there's no api.drupal.org listed there. Maybe it should be added?

Comments

pwolanin’s picture

There is a snippets section of the handbook, as well as example modules. There was some work in progress by chx to add commenting to API module, but not sure of the status of that.

dave reid’s picture

The issue pwolanin refers to is at #101308: Add commenting on API objects.

avpaderno’s picture

Status: Active » Fixed

Comments on api.drupal.org has been implemented. I am setting this report as fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.