You are here

function recipe_import_form_build_preview in Recipe 7.2

Same name and namespace in other branches
  1. 6 recipe.module \recipe_import_form_build_preview()
  2. 7 recipe.module \recipe_import_form_build_preview()

Form submission handler for recipe_import_form() 'Preview' button.

Import preview routine that allows that users to see what actually will be imported before doing so.

1 string reference to 'recipe_import_form_build_preview'
recipe_import_form in ./recipe.admin.inc
Page callback: Constructs a form for importing a single recipe.

File

./recipe.admin.inc, line 190
Contains admin page callbacks, form validation, and form submission handlers.

Code

function recipe_import_form_build_preview($form, &$form_state) {
  drupal_add_css(drupal_get_path('module', 'recipe') . '/recipe.css');
  $parsed_recipe_object = recipe_import_parse($form, $form_state);
  if ($parsed_recipe_object != FALSE) {

    //$node = node_form_submit_build_node($form, $form_state);
    $node = recipe_import_get_node($parsed_recipe_object);
    $cloned_node = clone $node;
    $cloned_node->in_preview = 1;
    $form_state['node_preview'] = theme('node_preview', array(
      'node' => $cloned_node,
    ));
    $form_state['rebuild'] = TRUE;
    drupal_set_title(t('Preview'));
  }
}