mysite_block_handler($data)
mysite.module, line 2937
Data handling for block placement. This function is part of the API.
Returns links to MySite actions to the mysite_block() based on the current path.
Called by the mysite_type_hook_block() functions, this allows all block links to be formatted by a single function.
$data The $data array prepared by mysite_type_hook_block(). The $data array takes the format:
The content to be displayed by mysite_block().
function mysite_block_handler($data) {
if (isset($data['type_id'])) {
// has the user already saved this?
$mid = mysite_check($data['uid'], $data['type'], $data['type_id']);
// Get the title of this content.
$func = "mysite_type_". $data['type'] ."_title";
$title = $func($data['type_id']);
if ($mid <= 0) {
$link = mysite_add_link($data['uid'], $data['type'], $data['type_id']);
$content = '<ul><li>'. l(t("Add !name to your personal page", array('!name' => $title)), $link) .'</li></ul>';
}
else {
$link = mysite_remove_link($data['uid'], $mid);
$content = '<ul><li>'. l(t("Remove !name from your personal page", array('!name' => $title)), $link) .'</li></ul>';
}
return $content;
}
}