function contextual_links_example_object_load
Menu loader callback for the object defined by this module.
Parameters
int $id: The ID of the object to load.
Return value
object|FALSE A fully loaded object, or FALSE if the object does not exist.
Related topics
2 calls to contextual_links_example_object_load()
- contextual_links_example_block_view in contextual_links_example/
contextual_links_example.module - Implements hook_block_view().
- contextual_links_overview_page in contextual_links_example/
contextual_links_example.module - Menu callback; displays a listing of objects defined by this module.
File
-
contextual_links_example/
contextual_links_example.module, line 158
Code
function contextual_links_example_object_load($id) {
// In a real use case, this function might load an object from the database.
// For the sake of this example, we just define a stub object with a basic
// title and content for any numeric ID that is passed in.
if (is_numeric($id)) {
$object = new stdClass();
$object->id = $id;
$object->title = t('Title for example object @id', array(
'@id' => $id,
));
$object->content = t('This is the content of example object @id.', array(
'@id' => $id,
));
return $object;
}
else {
return FALSE;
}
}