The current syntax for book_toc() has a non-optional parameter ($depth) after an optional one ($exclude), which effectively disables the optional-ness of the second parameter.

It would be better to have the optional parameter go after the non-optional ones. Alternatively, since the book structure can only host 9-level deep books, a default value of 9 could be added to the depth parameter, which would not require any change to existing code.

CommentFileSizeAuthor
#1 jsomers_361529_1.patch1.95 KBj.somers
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

j.somers’s picture

Status: Active » Needs review
FileSize
1.95 KB

Attached patch switches these two variables.

fgm’s picture

I wonder whether the other option, i.e. adding a default value of 9 to $depth_limit, wouldn't be better, as it would be one less conversion for module updates, while restoring optionalness.

catch’s picture

Status: Needs review » Reviewed & tested by the community

I don't think many modules are calling this function, simple re-ordering of the parameters, rtbc.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks!

catch’s picture

Status: Fixed » Needs work
j.somers’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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