You are here

function menu_example_arg_optional_load in Examples for Developers 7

Same name and namespace in other branches
  1. 6 menu_example/menu_example.module \menu_example_arg_optional_load()

Loads an item based on its $id.

In this case we're just creating a more extensive string. In a real example we would load or create some type of object.

Parameters

int $id: Id of the item.

Related topics

File

menu_example/menu_example.module, line 514
Module file for menu_example.

Code

function menu_example_arg_optional_load($id) {
  $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,
    ));
  }
}