function theme_recipe_summary in Recipe 7.2
Same name and namespace in other branches
- 6 recipe.module \theme_recipe_summary()
- 7 recipe.module \theme_recipe_summary()
Returns HTML for displaying the recipe summary box.
1 string reference to 'theme_recipe_summary'
- recipe_theme in ./
recipe.module - Implements hook_theme().
2 theme calls to theme_recipe_summary()
- recipe_block_view in ./
recipe.module - Implements hook_block_view().
- recipe_view in ./
recipe.module - Implements hook_view().
File
- ./
recipe.module, line 934 - Contains functions for Recipe node CRUD and display.
Code
function theme_recipe_summary($variables) {
$node = $variables['node'];
$show_title = isset($variables['show_title']) ? $variables['show_title'] : FALSE;
$show_yield_form = isset($variables['show_yield_form']) ? $variables['show_yield_form'] : TRUE;
// Construct the summary
$output = '<div class="recipe-summary">';
if ($show_title) {
$output .= '<h2 class="title">' . t('Summary') . '</h2>';
}
$output .= '<table>';
// Render the yield form.
$yield_form = drupal_get_form('recipe_yield_form', $node, $show_yield_form);
$output .= '<tr><th class="summary-title">' . t('Yield') . '</th><td class="summary-data">' . drupal_render($yield_form) . '</td></tr>';
// Print the total time if the prep and cook times are set.
if (isset($node->recipe_cook_time[LANGUAGE_NONE][0]['value']) && isset($node->recipe_prep_time[LANGUAGE_NONE][0]['value'])) {
$duration = $node->recipe_cook_time[LANGUAGE_NONE][0]['value'] + $node->recipe_prep_time[LANGUAGE_NONE][0]['value'];
$_text = theme('recipe_duration', array(
'duration' => $duration,
));
// Wrap the total time in RDFa markup.
if (!empty($node->rdf_mapping['recipe_totaltime'])) {
$attributes = rdf_rdfa_attributes($node->rdf_mapping['recipe_totaltime']);
$attributes['content'] = array(
recipe_duration_iso8601($duration),
);
$_text = theme('rdf_template_variable_wrapper', array(
'content' => $_text,
'attributes' => $attributes,
'inline' => FALSE,
));
}
$output .= '<tr><th>' . t('Total time') . '</th><td>' . $_text . '</td></tr>';
}
$output .= '</table>';
$output .= '</div>';
return $output;
}