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.
Part of meta-issue #1310084: [meta] API documentation cleanup sprint
Comment | File | Size | Author |
---|---|---|---|
#37 | book_clean-up-doc-D8-1327484-36.patch | 29.86 KB | nmudgal |
#32 | book_clean-up-doc-D8-1327484-31.patch | 1.17 KB | nmudgal |
#30 | book_clean-up-doc-D8-1327484-29.patch | 1.14 KB | nmudgal |
#28 | book_clean-up-doc-1327484-27.patch | 29.57 KB | nmudgal |
#25 | book-clean-up-documentation-1327484-25.patch | 29.85 KB | oriol_e9g |
Comments
Comment #1
xenophyle CreditAttribution: xenophyle commentedMy first book module patch. May it be perfect.
Comment #2
jhodgdonThanks! It looks pretty good, but not quite perfect... [Note: I didn't verify the accuracy of the @param and @return sections you added -- was just looking at formatting, style, etc.]
a)
All docblocks including @file ones need to start with a one line description.
http://drupal.org/node/1354#files
b) We just decided on a different standard for these things (see #1337282: Lacking doc header standard for forms used as page callbacks):
Technically, the page callback here is drupal_get_form(), so we don't put "page callback" in the one-line description for the form constructor. Leave the Path: line in and the reference to hook_menu() though.
c)
This is actually a form submission handler:
d)
Extra blank line here at the end.
e)
Avoid mlid and bid and nid and stuff like that in text:
bid -> book ID
mlid -> menu link ID
f) I realize you didn't write this originally, but what are the // here for?
Probably they should be removed?
g) Page callbacks don't need @return:
Comment #3
xenophyle CreditAttribution: xenophyle commentedI was wondering about the slashes myself. If a documentation expert doesn't know what they are for then it makes sense to remove them.
I think my rephrasing of "Updates the bid for a page and its children when it is moved to a new book." to
"Updates the book ID of a page and its children when it moves to a new book." is a little weak but I just couldn't come up with anything informative that would fit in 80 characters.
Comment #4
xenophyle CreditAttribution: xenophyle commentedAlso, should I redo the patches for the other modules to reflect the change for Page callback: Form constructor...?
Comment #5
xjmRe: #4. http://drupal.org/node/1354#forms has been updated for this. The conclusion we came to was just using the pattern you are in #3; that is: add the path and the
@see
to thehook_menu()
implementation, but not thePage callback:
part since the form constructors themselves are technically not the page callbacks. So yeah, we should use that pattern in all of them.Setting NR for testbot.
Comment #6
jhodgdonThis is looking pretty good! I did find a couple of things that I think should be fixed:
a)
+ * Access callback: Determines if the user can remove nodes from the outline.
+ *
+ * Path: node/%node/outline/remove
+ *
+ * @param $node
+ * The node to delete.
+ *
+ * @see book_menu()
*/
function _book_outline_remove_access($node) {
Technically, $node is not being deleted, just removed from the outline, right?
Similarly, in this case $node could be being added, deleted, etc., not just saved:
b)
This threw me a bit, because it calls what it's working on a "book link" twice and a "menu link" once -- maybe standardize on one or the other? Also, you could say "The ID of the node" rather than "the node ID of the node".
c) Generally in text, it is preferable to use "ID" rather than things like "mlid", "nid" etc. Such as here:
mlid -> menu link ID
Also here (id -> ID):
An integer representing the node id (nid) of the node to export.
d) This could use a few more words (filled -> filled in; and link translated => and the link translated), and what is $item?
+ * A menu link, with $item['access'] filled and link translated for rendering.
e)
Umm... First off, list items should end in ".", and "printer friendly" should be printer-friendly. But... is 'html' actually giving you printer-friendly output -- that seems wrong, as normally HTML is browser-friendly?
I guess that might be a separate issue and not part of the cleanup but it jumped out at me.
Comment #7
xenophyle CreditAttribution: xenophyle commentedFor d) I had copied the return value from menu_link_load(), but now I have changed it so it doesn't specifically mention $item['access'], which seemed arbitrary considering all the other values present in the array.
For e) I left in the "printer-friendly", since I think the idea is that you can print the page that the HTML output produces.
Thanks for the review.
Comment #8
jhodgdonI still don't get why HTML output should be labeled "printer-friendly"?
EDIT/added: I mean, if it's just producing ordinary HTML output, just say that?
Comment #9
xenophyle CreditAttribution: xenophyle commentedIt looks like "HTML (printer-friendly output)" is what you get when you click the "Printer-friendly version" link at the bottom of a node--for example on http://drupal.org/documentation/install. Maybe it would be better to phrase it
html: Printer-friendly HTML.
or
html: Printer-friendly version of the current page and its children.
Comment #10
xjmWell, printer-friendly HTML is usually stripped of images, layout, etc. and styled with CSS for print media rather than browsers. That's what the print module does. I didn't even know this feature was in core, though... I thought the "printer-friendly version" links were from the print module.
Comment #11
xjmSee book_export_html().
Comment #12
jhodgdonAh. OK then, that makes sense. Let's just call it "printer-friendly HTML" then, not "HTML (printer friendly output)".
RE #10 - From book_menu:
That is the URL that those printer-friendly links at the bottom of book pages are going to. Live and learn!
Comment #13
xenophyle CreditAttribution: xenophyle commentedChanged to "Printer-friendly HTML".
Comment #14
xjm"Printer-friendly HTML" looks good to me. I read the patch (didn't apply) and found a few more things:
This is a little odd; as written, the summary says that we're helping recursively, not building recursively. In any case, how about simplifying it to:
This is also a little confusing. How about:
Should we add an @see here to node_delete_confirm()?
Maybe "An array of menu link ID and title pairs"?
I believe this should begin, "Updates the Book module's persistent variables..."
This should just be
<div> elements
(no escaping). (I noticed this when I looked up this function on api.d.o earlier.)Thanks!
2 days to next Drupal core point release.
Comment #15
xenophyle CreditAttribution: xenophyle commented1. I changed to "Helps build the main table in the book administration page form." since another function already claims to build the table.
4. There doesn't seem to be a very graceful way to phrase this, since a hyphen, which could normally be used (i.e. x-y pairs), would only link "ID" and "title". How about "An array of (menu link ID, title) pairs"? Is that too codey? For now I have used "and" as suggested.
Thanks again for your endless QA; it must get tiring.
Comment #16
xenophyle CreditAttribution: xenophyle commentedOops, I just realized the I didn't save files before making the patch.
Comment #17
xenophyle CreditAttribution: xenophyle commentedComment #18
jhodgdonRE #14/15 item 4 - I think the suggestion in #15 makes for the clearest documentation, even if it isn't plain English.
Comment #19
xenophyle CreditAttribution: xenophyle commentedHere is the patch with the change for #4.
Comment #20
xenophyle CreditAttribution: xenophyle commentedRedo preprocessing documentation as discussed in http://drupal.org/node/1357138#comment-5309840
Comment #21
jhodgdonLooks good! Let's get this in. :)
Comment #22
catchLooks good to me too. Committed/pushed to 8.x. Thanks!
Comment #24
xjmComment #25
oriol_e9gComment #26
jhodgdonThanks for the port, and sorry for the delay in reviewing!
Anyway, this patch looks mostly good. The only thing that we need to cut out is these lines:
At least on the other D7 ports, these lines pointing back to the hook_menu() are "part of a new standard" (for menu callbacks) and are not supposed to be backported. I'm not sure if I understand the logic, but that's what we've been doing. So if you can take those out, we can OK this patch. Thanks!
Oh, one more thing. These types of lines:
Should change ; to :
Comment #27
xjm* Menu callback; prints a listing of all books.
...And additionally capitalize "Prints." :) (The reasoning for allowing that backport is that the summaries are already more or less in line with the "new" standard, so we can reformat them a little and get away with backporting them.)
Comment #28
nmudgal CreditAttribution: nmudgal commentedLooks like little work is remaining but stuck since ages, so let me just pick it up :-)
re-rolled patch according to #26, #27
Comment #29
jhodgdonUh oh. I reviewed the D7 patch in #28 and found a few things, but they need to be fixed in the Drupal 8 version actually (and then put into the D7 patch too):
a) in book.pages.inc, the first line description of book_export_html() needs to start with a verb:
b) in book.module, this isn't quite right:
Should say Implements hook... for node_form() on the first line. Just a bit farther down, there's another one:
--- c) And then in the D7 patch, there is one other thing that will need to be fixed:
Take out "Menu callback;" from the first line. [that is already correct in D8]
So: first a D8 patch to fix those two items, then once that is committed, we also need a D7 patch to fix the three items there.
Comment #30
nmudgal CreditAttribution: nmudgal commentedAttached patch fix point 'a' & 'b' for D8
Comment #31
jhodgdonThanks, but not quite right...
On (b)... Currently, it says:
Implements hook_form_BASE_FORM_ID_alter().
It needs to follow
http://drupal.org/node/1354#hookimpl (second example).
And for (a) it needs to start with "Generates" not "Generate".
Comment #32
nmudgal CreditAttribution: nmudgal commentedUpdated, thanks.
Comment #33
nmudgal CreditAttribution: nmudgal commentedoops
Comment #35
nmudgal CreditAttribution: nmudgal commented#32: book_clean-up-doc-D8-1327484-31.patch queued for re-testing.
Comment #36
jhodgdonThanks! Patch in #32 committed to Drupal 8.
Moving back to D7, where the patch in #28 needs these fixes, plus (c) from #29.
Comment #37
nmudgal CreditAttribution: nmudgal commentedHere it the updated patch according to #29.
Comment #38
nmudgal CreditAttribution: nmudgal commentedoops, wrong name though :-|
Comment #39
jhodgdonLooks good! Committed to 7.x. :)
Comment #40
nmudgal CreditAttribution: nmudgal commentedIn one go :-) cool, thanks.
Comment #42
Lars Toomre CreditAttribution: Lars Toomre commentedFor reference, I opened up #1807688: Further clean up of API docs for Book module for further documentation revisions to the Book module.