diff --git a/relation_select.module b/relation_select.module index 0aae465..7aaf8ff 100644 --- a/relation_select.module +++ b/relation_select.module @@ -897,6 +897,7 @@ } // Keep a copy of ajax page state - need this to add css/js files bit it is removed in views_ajax() $ajax_page_state = $_POST['ajax_page_state']; + $ajax_iframe_upload = !empty($_POST['ajax_iframe_upload']); $commands = array(); $views_ajax_commands = views_ajax(); foreach($views_ajax_commands['#commands'] as $command){ @@ -906,8 +907,21 @@ } // Re-define ajax_post_state before rendering to allow css/js files used by the view to be added $_POST['ajax_page_state'] = $ajax_page_state; - print ajax_render($commands); - exit(); + $_POST['ajax_iframe_upload'] = $ajax_iframe_upload; + + return array('#commands' => $commands, '#type' => 'ajax'); +} + +/** + * Implements hook_views_ajax_data_alter(). + * + * This hook is called from views_ajax(). + * views_ajax() rewrites $_GET['q']. + */ +function relation_select_views_ajax_data_alter($commands, $view) { + if ($_GET['q'] == 'relation-select/ajax' && isset($_GET['page']) && isset($_POST['ajax_iframe_upload'])) { + unset($_POST['ajax_iframe_upload']); + } } /**