API page: https://api.drupal.org/api/drupal/includes%21menu.inc/function/menu_tree...

Like stated by Matt-H on January 27, 2012 and sujoyit2005 on January 26, 2014:

The first line of the documentation for this function currently says, "Returns a rendered menu tree." This was true in previous versions, but in Drupal 7, the return is "a structured array to be rendered by drupal_render()." Therefore, the opening documentation should change as well.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhodgdon’s picture

Version: 7.x-dev » 8.x-dev
Issue tags: +Needs backport to D7, +Novice

Thanks! Needs to be fixed in 8.x first, then backported to 7.x. (Or more likely the same patch can be used for both, since the functions appear to be identical).

sandipmkhairnar’s picture

Updated code as per comments.

sandipmkhairnar’s picture

Status: Active » Needs review
sandipmkhairnar’s picture

Assigned: Unassigned » sandipmkhairnar
jhodgdon’s picture

Status: Needs review » Needs work

Thanks... but:

- * Returns a rendered menu tree.
+ * Returns a structured array to be rendered by drupal_render().

We lost the information here about what the function does, which is to set up to render a menu tree. This statement is what a lot of functions do (return a render array), not specific to what this function does (do that for a menu tree).

And really, the @return already talks about the structure of the returned value. So ... Maybe the first line should say something more like:

Creates an output structure for rendering a menu tree.

or something similar?

sandipmkhairnar’s picture

sandipmkhairnar’s picture

Status: Needs work » Needs review
jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Thanks!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 29b519c and pushed to 8.x. Thanks!

jhodgdon’s picture

Committed the same patch (with a little fuzz) also to 7.x. Thanks!

Status: Fixed » Closed (fixed)

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