You are here

function entity_example_basic_load in Examples for Developers 7

Fetch a basic object.

This function ends up being a shim between the menu system and entity_example_basic_load_multiple().

This function gets its name from the menu system's wildcard naming conventions. For example, /path/%wildcard would end up calling wildcard_load(%wildcard value). In our case defining the path: examples/entity_example/basic/%entity_example_basic in hook_menu() tells Drupal to call entity_example_basic_load().

Parameters

int $basic_id: Integer specifying the basic entity id.

bool $reset: A boolean indicating that the internal cache should be reset.

Return value

object A fully-loaded $basic object or FALSE if it cannot be loaded.

See also

entity_example_basic_load_multiple()

entity_example_menu()

Related topics

File

entity_example/entity_example.module, line 121
Implements the basic functionality required to create and display an entity.

Code

function entity_example_basic_load($basic_id = NULL, $reset = FALSE) {
  $basic_ids = isset($basic_id) ? array(
    $basic_id,
  ) : array();
  $basic = entity_example_basic_load_multiple($basic_ids, array(), $reset);
  return $basic ? reset($basic) : FALSE;
}