function node_form_add_preview in Drupal 5
Same name and namespace in other branches
- 4 modules/node.module \node_form_add_preview()
1 string reference to 'node_form_add_preview'
- node_form in modules/node/node.module
- Generate the node add/edit form array.
File
- modules/node/node.module, line 2179
- The core that allows content to be submitted to the site. Modules and scripts may
programmatically submit nodes using the usual form API pattern.
Code
function node_form_add_preview($form) {
global $form_values;
$op = isset($form_values['op']) ? $form_values['op'] : '';
if ($op == t('Preview')) {
drupal_validate_form($form['form_id']['#value'], $form);
if (!form_get_errors()) {
$preview = node_preview((object) $form_values);
$form['#prefix'] = isset($form['#prefix']) ? $preview . $form['#prefix'] : $preview;
}
}
if (variable_get('node_preview', 0) && (form_get_errors() || $op != t('Preview'))) {
unset($form['submit']);
}
return $form;
}