Commit 71db34bd authored by Dries's avatar Dries

- Patch #1244980 by sven.lauer: hook_menu()'s documentation doesn't include ITEM_to_arg().

parent b247b848
......@@ -1016,8 +1016,33 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
* return db_query("SELECT * FROM {mymodule_abc} WHERE abc_id = :abc_id", array(':abc_id' => $abc_id))->fetchObject();
* }
* @endcode
* This 'abc' object will then be passed into the page callback function
* mymodule_abc_edit() to replace the integer 1 in the page arguments.
* This 'abc' object will then be passed into the callback functions defined
* for the menu item, such as the page callback function mymodule_abc_edit()
* to replace the integer 1 in the argument array.
*
* You can also define a %wildcard_to_arg() function (for the example menu
* entry above this would be 'mymodule_abc_to_arg()'). The _to_arg() function
* is invoked to retrieve a value that is used in the path in place of the
* wildcard. A good example is user.module, which defines
* user_uid_optional_to_arg() (corresponding to the menu entry
* 'user/%user_uid_optional'). This function returns the user ID of the
* current user.
*
* The _to_arg() function will get called with three arguments:
* - $arg: A string representing whatever argument may have been supplied by
* the caller (this is particularly useful if you want the _to_arg()
* function only supply a (default) value if no other value is specified,
* as in the case of user_uid_optional_to_arg().
* - $map: An array of all path fragments (e.g. array('node','123','edit') for
* 'node/123/edit').
* - $index: An integer indicating which element of $map corresponds to $arg.
*
* _load() and _to_arg() functions may seem similar at first glance, but they
* have different purposes and are called at different times. _load()
* functions are called when the menu system is collecting arguments to pass
* to the callback functions defined for the menu item. _to_arg() functions
* are called when the menu system is generating links to related paths, such
* as the tabs for a set of MENU_LOCAL_TASK items.
*
* You can also make groups of menu items to be rendered (by default) as tabs
* on a page. To do that, first create one menu item of type MENU_NORMAL_ITEM,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment