The documentation page for Drupal 7 reports parameters that are not used from the function.

I think the description of the parameters is still from the Drupal 6 version of the function.

Comments

avpaderno’s picture

Title: book_form_update() parameters are not corrected » book_form_update() parameters are not correct

I am fixing a typo in the title.

avpaderno’s picture

Actually, also the documentation for Drupal 6 reports the same parameters, but the function declaration doesn't include them (see http://api.drupal.org/api/function/book_form_update/7, and http://api.drupal.org/api/function/book_form_update/6).

jhodgdon’s picture

Issue tags: +Novice

Good catch! Looks like both D7 and D6 docs need the @param sections removed.

This would be a good project for a novice contributor.

avpaderno’s picture

Status: Active » Needs review
StatusFileSize
new721 bytes

This is the patch for Drupal 7. Looking at the description for the return value, I am not sure it's correct.

jhodgdon’s picture

Status: Needs review » Needs work

It looks to me as though the return value is the rendered select element for the parent page. I don't think it's worded very well in the @return. Care to fix it?

avpaderno’s picture

Status: Needs work » Needs review
StatusFileSize
new726 bytes

Let's see if this works.

jhodgdon’s picture

Status: Needs review » Needs work

Hmmm. I can't get this patch to apply for me, although it's passing the tests. I believe there is already a @return segment in the file, and your patch isn't including it as context or -- lines?

avpaderno’s picture

You are right. The patch includes the new description for @return, but the patch doesn't mark it correctly.
Probably I didn't clean the local copy of the files, before to create the new patch.

avpaderno’s picture

I thought I re-rolled the patch, but it seems I forgot. I will do it in the next minutes.

avpaderno’s picture

Status: Needs work » Needs review
StatusFileSize
new879 bytes
jhodgdon’s picture

StatusFileSize
new1.37 KB

Thanks, that looks like a better patch.

Hmmm... This is the result:

/**
 * AJAX callback to replace the book parent select options.
 *
 * This function is called when the selected book is changed. It updates the
 * cached form (either the node form or the book outline form) and returns
 * rendered output to be used to replace the select containing the possible
 * parent pages in the newly selected book.
 *
 * @return
 *   The rendered select element for the parent page.
 */
function book_form_update() {

So... the above patch is fine, as far as it goes, but maybe we can make the whole doc block better while we're at it?

avpaderno’s picture

Status: Needs review » Reviewed & tested by the community

This is decisively better. I didn't change the description of the function as I was not 100% sure in which cases it was called.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

jhodgdon’s picture

Version: 7.x-dev » 6.x-dev
Status: Fixed » Patch (to be ported)

We should port this one to Drupal 6.

rdrh555’s picture

Assigned: Unassigned » rdrh555
Status: Patch (to be ported) » Needs review
StatusFileSize
new1.39 KB

The Drupal 6 version

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.34 KB

Looks good, except there is an extra space at the end of this line:
+ * This function is called via AJAX when the selected book is changed on a node

Here's the same patch with the space removed (and removed the Eclipse stuff at the top, since I needed to do that to make it apply in my Eclipse workspace).

gábor hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thanks.

Status: Fixed » Closed (fixed)
Issue tags: -Novice

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