function recipe_form in Recipe 7.2
Same name and namespace in other branches
- 5 recipe.module \recipe_form()
- 6 recipe.module \recipe_form()
- 7 recipe.module \recipe_form()
Implements hook_form().
File
- ./
recipe.module, line 166 - Contains functions for Recipe node CRUD and display.
Code
function recipe_form($node, &$form_state) {
// Title.
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Title'),
'#required' => TRUE,
'#default_value' => !empty($node->title) ? $node->title : '',
'#maxlength' => 255,
);
$form['recipe_yield'] = array(
'#type' => 'textfield',
'#title' => t('Yield'),
'#default_value' => !empty($node->recipe_yield) ? $node->recipe_yield : '',
'#size' => 4,
'#maxlength' => 4,
'#description' => t('The number of servings the recipe will make (whole number integer, ie 5 or 6).'),
'#required' => TRUE,
);
$form['recipe_yield_unit'] = array(
'#type' => 'textfield',
'#title' => t('Yield Units'),
'#default_value' => empty($node->recipe_yield_unit) ? t('Servings') : $node->recipe_yield_unit,
'#size' => 16,
'#maxlength' => 64,
'#description' => t('The units for the yield field(ie servings, people, cans, cookies, etc).'),
'#required' => FALSE,
);
return $form;
}