function recipe_yield_form in Recipe 7
Same name and namespace in other branches
- 6 recipe.module \recipe_yield_form()
- 7.2 recipe.module \recipe_yield_form()
Form constructor for the custom yield form.
Parameters
stdClass $node: The node object being displayed.
Bool $show_yield_form: TRUE if the custom yield form should be displayed.
1 string reference to 'recipe_yield_form'
- theme_recipe_summary in ./
recipe.module - Returns HTML for displaying the recipe summary box.
File
- ./
recipe.module, line 1428 - Contains functions for Recipe node CRUD and display.
Code
function recipe_yield_form($form, &$form_state, $node, $show_yield_form) {
// Don't render the custom yield textbox and submit buttons if disabled or shown in a block.
if ($show_yield_form == FALSE || variable_get('recipe_summary_location', 0) == 1) {
$form['yield'] = array(
'#markup' => $node->recipe_yield,
);
// An html space is useful here since we don't have a separate theme function for this form.
$form['_space'] = array(
'#markup' => ' ',
);
$form['yield_unit'] = array(
'#markup' => $node->recipe_yield_unit == '' ? t('Servings') : $node->recipe_yield_unit,
);
}
else {
$form['custom_yield'] = array(
'#type' => 'textfield',
'#default_value' => $node->recipe_yield,
'#size' => 2,
'#maxlength' => 4,
'#attributes' => array(
'class' => array(
'recipe-yield-value',
),
),
);
$form['yield_unit'] = array(
'#markup' => $node->recipe_yield_unit == '' ? t('Servings') : $node->recipe_yield_unit,
'#suffix' => '<br/>',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Change'),
'#attributes' => array(
'class' => array(
'recipe-yield-change',
),
),
);
$form['reset'] = array(
'#type' => 'submit',
'#value' => t('Reset'),
'#attributes' => array(
'class' => array(
'recipe-yield-reset',
),
),
);
$form['halve'] = array(
'#type' => 'submit',
'#value' => t('Halve'),
'#attributes' => array(
'class' => array(
'recipe-yield-halve',
),
),
);
$form['double'] = array(
'#type' => 'submit',
'#value' => t('Double'),
'#attributes' => array(
'class' => array(
'recipe-yield-double',
),
),
);
}
return $form;
}