function recipe_block_view in Recipe 7
Same name and namespace in other branches
- 7.2 recipe.module \recipe_block_view()
Implements hook_block_view().
File
- ./
recipe.module, line 675 - Contains functions for Recipe node CRUD and display.
Code
function recipe_block_view($delta = '') {
$block = array();
switch ($delta) {
case 'recent':
$node_list = recipe_get_latest(5);
if ($node_title_list = node_title_list($node_list)) {
$block['subject'] = t('Newest Recipes');
$block['content']['recipe_list'] = $node_title_list;
return $block;
}
break;
case 'summary':
if (user_access('access content')) {
if (arg(0) == 'node' && is_numeric(arg(1)) && (arg(2) == '' || arg(2) == 'view')) {
$node = node_load(arg(1));
if ($node->type == 'recipe') {
$block['subject'] = variable_get('recipe_summary_title', t('Summary'));
$block['content'] = theme('recipe_summary', array(
'node' => $node,
'show_title' => FALSE,
'show_yield_form' => TRUE,
));
return $block;
}
}
}
break;
}
}