Add hook_area_details() to allow modules to provide details about an area.
This commit is contained in:
parent
9908540a28
commit
e680e6c0bf
|
@ -49,6 +49,30 @@ function hook_farm_area_links($id) {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide details about farm areas.
|
||||
*
|
||||
* @param int $id
|
||||
* The area id.
|
||||
*
|
||||
* @return array
|
||||
* Returns a render array to add to the area's popup.
|
||||
*/
|
||||
function hook_farm_area_details($id) {
|
||||
|
||||
// Start a render array.
|
||||
$output = array();
|
||||
|
||||
// Add "Hello world!" to area details.
|
||||
$output[] = array(
|
||||
'#type' => 'markup',
|
||||
'#markup' => 'Hello world!',
|
||||
);
|
||||
|
||||
// Return the render array.
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -41,6 +41,24 @@ function farm_area_farm_taxonomy_breadcrumb($term) {
|
|||
return $breadcrumb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate area details.
|
||||
*
|
||||
* @param int $id
|
||||
* The area id.
|
||||
*
|
||||
* @return string
|
||||
* Returns a string of links.
|
||||
*/
|
||||
function farm_area_get_details($id) {
|
||||
|
||||
// Call out to modules that want to provide links.
|
||||
$area_details = module_invoke_all('farm_area_details', check_plain($id));
|
||||
|
||||
// Render and return.
|
||||
return drupal_render($area_details);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate area links, sorted by weight.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue