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.
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.
Comment | File | Size | Author |
---|---|---|---|
#1 | jsomers_361529_1.patch | 1.95 KB | j.somers |
Comments
Comment #1
j.somers CreditAttribution: j.somers commentedAttached patch switches these two variables.
Comment #2
fgmI 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.
Comment #3
catchI don't think many modules are calling this function, simple re-ordering of the parameters, rtbc.
Comment #4
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks!
Comment #5
catchNeeds adding to http://drupal.org/update/modules
Comment #6
j.somers CreditAttribution: j.somers commentedDocumentation added at http://drupal.org/node/224333#book_toc_parameters.