1 menu_example.module _menu_example_mappings($id)

Utility function to provide mappings from integers to some strings.

This would normally be some database lookup to get an object or array from a key.


int $id: The integer key.

Return value

string: The string to which the integer key mapped, or NULL if it did not map.

Related topics


modules/examples/menu_example/menu_example.module, line 400
Module file for menu_example.


function _menu_example_mappings($id) {
  $mapped_value = NULL;
  static $mappings = array(
    1 => 'one',
    2 => 'two',
    3 => 'three',
    99 => 'jackpot! default',
  if (isset($mappings[$id])) {
    $mapped_value = $mappings[$id];
  return $mapped_value;