function farm_plan_consideration_load in farmOS 7
Load a consideration from the database.
Parameters
int $id: The consideration ID.
Return value
object|bool Returns the consideration object, or FALSE if one doesn't exist.
3 calls to farm_plan_consideration_load()
- farm_plan_consideration_delete_form in modules/
farm/ farm_plan/ farm_plan_consideration/ farm_plan_consideration.module - Delete confirmation form.
- farm_plan_consideration_form in modules/
farm/ farm_plan/ farm_plan_consideration/ farm_plan_consideration.module - Build the farm plan considerations form.
- farm_plan_consideration_list in modules/
farm/ farm_plan/ farm_plan_consideration/ farm_plan_consideration.module - Page callback for considerations list, filtered for a plan.
File
- modules/
farm/ farm_plan/ farm_plan_consideration/ farm_plan_consideration.module, line 176 - Farm plan consideration module.
Code
function farm_plan_consideration_load($id) {
// Load the consideration record from the database.
$consideration = db_query('SELECT * FROM {farm_plan_consideration} WHERE id = :id', array(
':id' => $id,
))
->fetch();
// If a consideration couldn't be loaded, bail.
if (empty($consideration)) {
return FALSE;
}
// Load entity associations with this consideration.
$result = db_query('SELECT * FROM {farm_plan_consideration_entity} WHERE consideration_id = :id', array(
':id' => $id,
));
foreach ($result as $record) {
$consideration->entities[$record->entity_type][] = $record->entity_id;
}
// Return the consideration.
return $consideration;
}