function bg_image_node_type_ajax_callback in Background Images 6
Same name and namespace in other branches
- 7 bg_image.module \bg_image_node_type_ajax_callback()
AHAH Callback after Node Type has been chosen.
1 string reference to 'bg_image_node_type_ajax_callback'
- bg_image_menu in ./
bg_image.module - Implements hook_menu().
File
- ./
bg_image.module, line 222 - Allows for customizable background images per page
Code
function bg_image_node_type_ajax_callback() {
$form_state = array(
'storage' => NULL,
'rebuild' => TRUE,
);
$form_build_id = $_POST['form_build_id'];
$form = form_get_cache($form_build_id, $form_state);
$args = $form['#parameters'];
$form_id = array_shift($args);
$form_state['post'] = $form['#post'] = $_POST;
$form['#programmed'] = $form['#redirect'] = FALSE;
// Trickery to avoid the required field errors on AHAH replacement
$form['node']['bg_image_node_type']['#required'] = FALSE;
$form['node']['bg_image_node_field']['#required'] = FALSE;
drupal_process_form($form_id, $form, $form_state);
$form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);
// Render the field element
$element = $form['node']['bg_image_node_field'];
unset($element['#prefix'], $element['#suffix']);
$output = theme('status_messages') . drupal_render($element);
// Final rendering callback.
drupal_json(array(
'status' => TRUE,
'data' => $output,
));
}