Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function subhub_magicapi_2_app_block_form_ajax_callback(&$form, &$form_state) {
- $commands['#type'] = 'ajax';
- $commands['#commands'][] = ajax_command_insert(NULL, drupal_render($form['settings']));
- $commands['#commands'][] = ajax_command_prepend(NULL, theme('status_messages'));
- // If the form was validated & submitted, dismiss the dialogue & replace the block.
- if($form_state['executed']) {
- // Un-dialogue the dialogue.
- $commands['#commands'][] = ajax_command_invoke('div.settings', 'dialog', array('destroy'));
- // Remove it from the DOM.
- $commands['#commands'][] = ajax_command_remove('div.settings');
- // Reload the block that we've altered
- $delta = $form_state['build_info']['args'][0];
- $rendered_block = subhub_magicapi_2_block_renderer($delta);
- $instance = subhub_magicapi_2_split_delta($delta);
- // Using the block id to replace here doesn't work for some reason...
- $commands['#commands'][] = ajax_command_replace('div.mbid-' . $instance['mbid'], $rendered_block);
- }
- return $commands;
- }
Add Comment
Please, Sign In to add comment