function recipe_import_form in Recipe 6
Same name and namespace in other branches
- 7.2 recipe.admin.inc \recipe_import_form()
- 7 recipe.module \recipe_import_form()
Form recipe_import_form
1 string reference to 'recipe_import_form'
- recipe_menu in ./
recipe.module - Implementation of hook_menu().
File
- ./
recipe.module, line 1409 - recipe.module - share recipes
Code
function recipe_import_form($form_state) {
$formats = module_invoke_all('recipeio', 'import_single');
$options = array();
foreach ($formats as $format) {
$options[$format['callback']] = $format['format_name'];
}
if (isset($form_state['node_preview'])) {
$form['#prefix'] = $form_state['node_preview'];
}
$form['recipe_format'] = array(
'#type' => 'select',
'#title' => t('Recipe format'),
'#options' => $options,
'#default_value' => $form_state['values']['recipe_format'],
'#size' => 1,
'#description' => t('The recipe input format.'),
);
$form['recipe_import_text'] = array(
'#type' => 'textarea',
'#title' => t('Paste import data here'),
'#default_value' => $form_state['values']['recipe_import_text'],
'#cols' => 55,
'#rows' => 8,
'#required' => TRUE,
'#description' => t('Use 1 blank line between sections: Description, Ingredients, Instructions, Notes. Always use preview first to avoid unintended consequences.'),
);
$form['buttons']['preview'] = array(
'#type' => 'submit',
'#value' => t('Preview'),
'#weight' => 1,
'#submit' => array(
'recipe_import_form_build_preview',
),
);
$form['buttons']['import'] = array(
'#type' => 'submit',
'#value' => t('Import'),
'#weight' => 2,
'#submit' => array(
'recipe_import_form_submit',
),
);
return $form;
}