In API docs: change "post a comment" to "provide an example"

Created on 19 August 2011, almost 13 years ago
Updated 14 May 2024, about 2 months ago

A wise colleague of mine (geekyMoa, http://drupal.org/user/1097732), pointed out that api.drupal.org would be much more useful if there were more examples on how to use functions. This is apparently how WordPress has their documentation, and I know php.net has the same thing (and their examples have certainly been useful to me).

I dug around a bit to find prior discussion on this topic, and could find the following threads:
#576964: Examples in the API Doc β†’
#547534: Review "Commenting on handbook pages and API pages" β†’ (in particular comments 21, 31, 38, and 41).

I know there are other kinds of comments at api.drupal.org right now, but I can't recall ever having any use of them (and to frank, questions posted as comments on api.drupal.org very seldom get answered). Using comments for examples would, I think, make api.drupal.org much more useful.

I hereby suggest that we start officially using comments on api.drupal.org for posting examples, and make changes in the interface to make this clear.

Some minor notes

  • I don't expect that everyone will say "yes, ok", and then it will happen. I hope that there will be a discussion, and in the end a suggestion that is better than mine.
  • If you find this a good idea, please give cred to geekyMoa. If you find it a bad idea, blame me. :-)
  • An alternative to using comments for this, is to have a new node type with a node reference to the api page your example belongs to. That would require more architecture change, but probably a more flexible solution. And I'm for getting something done and useful, and then start improving, rather than trying to get the perfect solution from start.
✨ Feature request
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡ΈπŸ‡ͺSweden Itangalo

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024