| 6 menu_example.module | menu_example_id_load($id) |
| 7 menu_example.module | menu_example_id_load($id) |
| 8 menu_example.module | menu_example_id_load($id) |
The special _load function to load menu_example.
Given an integer $id, load the string that should be associated with it. Normally this load function would return an array or object with more information.
Parameters
$id: The integer to load.
Return value
A string loaded from the integer.
Related topics
File
- menu_example/
menu_example.module, line 366 - Demonstrates uses of the Menu APIs in Drupal, including hook_menu(), hook_menu_alter(), and hook_menu_link_alter().
Code
function menu_example_id_load($id) {
// Just map a magic value here. Normally this would load some more complex
// object from the database or other context.
$mapped_value = _menu_example_mappings($id);
if (!empty($mapped_value)) {
return t('Loaded value was %loaded', array('%loaded' => $mapped_value));
}
else {
return t('Sorry, the id %id was not found to be loaded', array('%id' => $id));
}
}
Login or register to post comments