Closed (fixed)
Project:
Examples for Developers
Version:
7.x-1.x-dev
Component:
Other
Priority:
Critical
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
10 Apr 2010 at 02:30 UTC
Updated:
10 Oct 2011 at 03:51 UTC
Jump to comment: Most recent file
Comments
Comment #1
cyberswat commentedMaybe we simply need to rework the comments so that they work really well being displayed on the api site. I think it is a little misleading and possibly confusing for newer developers to see those examples without a clear reference to all of the pieces that make them work. I have to admit that I'm not familiar enough with phpdoc but it looks like a change in wording and appropriate use of the @see or @link tag is the way to go. Here's a super quick patch that might help with node_example.
Comment #2
cyberswat commentedComment #3
rfayI think we're going to need more than this, on all the examples. In the next comment I'll try to write up a bigger list of what I think needs to be done. This is a decent start though - just adding the referral to the install should work.
(I'm not sure whether @see on a file will work)
important
Powered by Dreditor.
Comment #4
rfayHere's a braindump of what I'm thinking after looking at lots of the examples on api.drupal.org.
1. To be successful working with the doxygen comments, you'll need to set up the API module. Lately this hasn't been too hard, but you need to use the dev versions of api and grammar_parser. Set up using the instructions at http://drupal.org/node/425944. When you have an API site set up, you can just run cron and immediately see the result of your doxygen.
2. Every example group docblock should have at the bottom something like "This example is part of the @link http://drupal.org/project/examples Examples for Developers Project @endlink which you can download and experiment with.
3. Groups are going to be the way that people find their way to the entire example, grouped together. If you take a look at the AJAX Example, which seems to be working the best this way, It has a main group:
http://api.drupal.org/api/group/ajax_examples/7
That lists each of the examples. Then each of those, for example,
http://api.drupal.org/api/function/ajax_example_autocheckboxes/7
shows up in a description and has its own page.
This is done with @defgroup and @ingroup, as you'll see in the AJAX examples.
Doxygen documentation is at http://drupal.org/node/1354.
4. Example groups should be
Individual examples should be in a group named like
5. We need a master group (Examples) that will be in a main examples.module. The examples.module should be mostly doxy comments that point to the other examples. It will also have a hook_help() explaining its purpose and how to access the other examples.
6. Each example or group should link to its parent group with @ingroup. For example:
7. This is a work in progress. We'll have to make some changes when we see how the api docs come out. Let's make sure we get one module correct before proceding. I think the form example is a good place to start. It has 10 examples in two groups (so far).
[Edit: I changed the above a bit based on feedback from jhodgdon.]
Comment #5
jhodgdonA couple of comments:
#3: @see on a file should work. If it doesn't, that's a bug in the API module.
#4:
item 2 - I think having a link to the Examples project is a great idea. But I think the link text being "Example module" is not great. How about just
This example is part of the @link http://drupal.org/project/examples Examples for Developers project @endlink.
(not sure if putting . right after @endlink screws it up?)
item 3 - Making a group for each example will greatly add to the already too big list of topics on api.drupal.org. If you are set on doing this, at least maybe you can start the human-readable group names all with "Example", so they'll sort together in alphabetical order on the topics list?
http://api.drupal.org/api/groups/7
Check out the hints section here about not adding too many topics:
http://drupal.org/node/1354#hints
Comment #6
rfayI edited #4 to reflect all of jhodgdon's concerns (I think). We talked in IRC and she's reluctantly OK with having lots of new groups.
Comment #7
rfayHere's a first pass at some cleanup on the D7 Form Example. I think the generated docs come out OK. If it passes the bot, I'll commit it and everybody can peruse the results and see if they like them.
Comment #8
rfayHEAD still broken, so I went ahead and committed this one: http://drupal.org/cvs?commit=353976
We'll see what API.d.o looks like in the morning and whether we like it or not.
Comment #10
rfayOK, here's what the D7 Form example looks like after the rework of doxy blocks:
http://api.drupal.org/api/group/form_example/7
Please browse around the 11 examples in the form_example module and see if you think it works.
I didn't make groups for each example. Instead, I just made sure that there were proper @see's in each function.
BTW: HEAD is fixed now.
Comment #11
jhodgdonI'm not sure why the main form example page needs two links to the same project page -- it was a bit confusing to me on first quick scan, because their link text is different. But that's very minor.
I also thought maybe you could rename the example functions form_example_tutorial_01, 02, etc. so that 10 would come after them in alphabetical order. Again, very minor.
Other than that, it seems fine to me.
Comment #12
rfayHere's another pass. This addresses the comments in #11. Just by happenstance I deleted a test (#8) so that will help the ordering.
The most important change in this patch though is that #8 and #9 (the add-more and multistep examples) have been significantly reworked again, per advice from @effulgentsia. Although they're not as general as a real form would be (maybe #8 is) the intent is to show the mechanism.
Comment #13
rfayCommitted to HEAD: http://drupal.org/cvs?commit=355264
This will probably need to be backported to the D6 version of the form examples.
Comment #14
rfayComment #15
mile23I did this for D6. (Insomnia. Woot.) Added lots and lots of doxygen tags to the various modules, with only minimal editing of the actual documentation.
Shall I put the patch here or make another issue?
Comment #16
rfayYippee! Go ahead and put it here. There seems to be a never-ending amount of this work, as this project increased in scope much more than we thought.
#4 is the roadmap for what we want to accomplish. There's plenty of work left to do on that in both D7 and D6.
Thanks!
Comment #17
mile23Clearly the actual documentation content is somewhat incomplete. Also, I only added a stub hook_help() in examples.module.
Comment #19
rfayIn http://qa.drupal.org/pifr/test/114534, open up the "review log" fieldset to see the patch apply failures. I get the same failures when applying locally. It looks like you might have started with an older version (and didn't pick up the xmlrpc changes that went in on 13 Dec)
Comment #20
mile23Yes, the joke's on me. On the other hand, I can now endorse DiffMerge for Mac as a useful tool.
Comment #21
rfayCommitted, with one small change in page_example (where the hook_help() had been removed).
http://drupal.org/cvs?commit=470470
Thanks so much!
Comment #22
rfayNow, for onward and forward.
@Mile23,
* if you could review the api.drupal.org results with after it gets rebuilt (tomorrow or later)
* Then D7, right?
* Also we can continue this with many other "how to navigate issues" with Examples. Probably, though, when we get api.d.o working the way we want, we can do the other things in other issues.
Thanks!
Comment #23
ilo commentedThank you both so much for this commit!
Comment #24
mile23Rawk. :-)
I have a local drupal install that has API, and that's how I was
learning doxygentesting the output.Comment #25
mile23Inadvertently moved the discussion here: #761334: Organize Examples in a way that the whole project can be understood
Comment #26
mile23OK, so I guess I'll bomb forward on the D7 examples, in the same pattern as the D6 ones.
Comment #27
mile23Added a lot of doxygen to most of the D7 part of Examples. A few exceptions: I left out nodeapi and node_access because of various discussions about their appropriateness: #1028162: Review Node Access example in light of ch 9 of Drupal 7 Module Development #947334: Node access example comment; Improve discussion of grants #1015846: Module should not delete fields on uninstall
Also, I wasn't very thorough with reworking the documentation itself, just the format. So some modules suffer a bit because of this.
Comment #29
mile23Hmm... How did vertical_tabs_example.js end up with CRLF line endings? :-) Helpful hints here: http://help.github.com/dealing-with-lineendings/
Comment #31
rfay#29: d7_examples_module_lf_767204.patch queued for re-testing.
Comment #33
mile23Note to self: Run The Tests Locally First. :-) Also: Yay agile!
Comment #35
mile23#33: d7_examples_module_wtf_767204.patch queued for re-testing.
Comment #37
mile23#33: d7_examples_module_wtf_767204.patch queued for re-testing.
Comment #38
mile23You know... It was a lot of work. :-)
Comment #39
rfayAnd very much appreciated.
I apologize that I've been out of service. Trying to focus on the Git migration and just ignoring this queue. But we'll get your application approved and we should be good to get things committed more often.
Comment #40
dave reidComment #41
mile23I'll come back to this in the next week unless someone objects. :-)
Comment #42
tr commented@Mile23: That would be fantastic. I'd like to get this put in as soon as possible. The patch needs to be re-rolled against the latest head - there are a bunch of small changes that already got fixed that now conflict with the same small changes you make in your patch. I actually started to port the patch, and if you don't mind I'll finish that up this weekend and post it, then let you check to make sure I didn't mangle any of your work.
Comment #43
mile23OK, sounds good. :-)
Comment #44
mile23Comment #45
tr commentedHere's a new version of the patch rebased to the current head of 7.x-1.x. I added a lot of minor changes to the doxygen comments to conform to the style guidelines, but there's still a lot to to. I don't think it all needs to be done in this issue.
Comment #46
mile23Looks good. Coder gave me some hiccups so here's yet another patch. :-)
Most of the doxy framework is there in my old patch. Specific formatting can be done in their own issues as people find them. I think it's more important to get the doxy committed at this point, so api.drupal.org can trawl them. After that, core patch time to link to it correctly, and people can start patching the egregious errors they find.
Then it's on to #761334: Organize Examples in a way that the whole project can be understood :-)
Comment #48
tr commented@Mile23: It looks like your patch is reversed.
Comment #49
mile23Lesson: One coffee not enough.
Comment #50
rfaySo sorry I've been so delinquent on this.
Here's a reroll, which fixes a couple of whitespace issues and removes the CHANGELOG.txt's that were still surviving.
If this survives the testbot please look at it quickly and let's get it in before it kills us. Thanks for all the great work on this, @Mile23 et al.
Comment #51
rfayComment #52
rfayOK, I committed this, but without the changes to node_access_example.module, because it had a thorough going-over in #947334: Node access example comment; Improve discussion of grants (and there were lots of conflicts)
But here we go!
D7: e652b54
D8: 39ddf0d
Thanks so much for all the wonderful work on this, @Mile23. So sorry it got stuck. Mea culpa.
Comment #54
mile23Oo... Thanks rfay. I should log in to d.o more often. :-)
Comment #55
mile23Missed one.... Good old nodeapi_example. :-)
This might crash up against #1115944: Variables aren't cleaned up on uninstall.
Comment #56
tr commentedPatch in #50 introduced D7 code into the D8 branch. Fixed in commit c0f027551980.
Comment #57
rfayThanks TR.
Comment #58
rfayCommitted: #55: dc2b847
Sorry, I had missed that this one was hanging out.