commit 76763cafe21e7f57442d529d9c835287131b7dcb Author: Lee Rowlands Date: Thu Nov 15 18:38:33 2012 +1000 patch 68 diff --git a/core/includes/ajax.api.php b/core/includes/ajax.api.php new file mode 100644 index 0000000..1c6ec2d --- /dev/null +++ b/core/includes/ajax.api.php @@ -0,0 +1,79 @@ +get('request')->query->get('destination'); if (!empty($destination) && !url_is_external($destination)) { $parsed_destination = drupal_parse_url($destination); @@ -1210,8 +1210,8 @@ function ajax_render_modal_form($form_id, $args) { // Build and render the form. $form = drupal_build_form($form_id, $form_state); $output = drupal_render($form); - // Some forms may have the title built in, if so set the title here (for non - // javascript users): + // Some forms may have the title built in, if so set the title here (for + // non-JavaScript users): if (empty($form_state['ajax']) && !empty($form_state['title'])) { drupal_set_title($form_state['title']); } @@ -1228,14 +1228,12 @@ function ajax_render_modal_form($form_id, $args) { $display .= $output; $title = empty($form_state['title']) ? drupal_get_title() : $form_state['title']; - // @todo document hook drupal_alter(array('ajax_form_title', 'ajax_form_title_' . $form_id), $title, $form_state); $url = empty($form_state['url']) ? url(current_path(), array('absolute' => TRUE, 'query' => drupal_container()->get('request')->query->all())) : $form_state['url']; $commands[] = ajax_command_set_modal($display, $title, $url); - // @todo document hook drupal_alter(array('ajax_form_commands', 'ajax_form_commands_' . $form_id), $commands, $form_state); return array('#type' => 'ajax', '#commands' => $commands); @@ -1258,12 +1256,12 @@ function ajax_render_modal_form($form_id, $args) { drupal_alter(array('ajax_form_commands', 'ajax_form_commands_' . $form_id), $commands, $form_state); return array('#type' => 'ajax', '#commands' => $commands); } - // Degrade to non-javascript behaviour. + // Degrade to non-JavaScript behaviour. drupal_redirect_form($form_state); } - // Non javascript invocation - degrade to standard drupal_build_form - // behaviour. Forms can have the title built in, if so set the title here: + // Non-JavaScript invocation - degrade to standard drupal_build_form() + // behavior. Forms can have the title built in, if so set the title here: if (empty($form_state['ajax']) && !empty($form_state['title'])) { drupal_set_title($form_state['title']); } @@ -1313,7 +1311,7 @@ function ajax_command_dismiss_modal() { * Form builder wrapper for displaying ajax forms in modals. * * Modules should use this as a menu callback to handle displaying forms in - * modals. Example hook_menu () item + * modals. Example hook_menu() item * @code * $items['node/%node/delete'] = array( * 'title' => 'Delete', @@ -1342,7 +1340,7 @@ function ajax_command_dismiss_modal() { * * @see l() */ -function ajax_modal_form($form_id) { +function drupal_get_form_modal($form_id) { // Get the form build arguments. $args = func_get_args(); // Remove the $form_id. diff --git a/core/modules/node/node.module b/core/modules/node/node.module index c1d2c43..2b97776 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -1793,7 +1793,7 @@ function node_menu() { ); $items['node/%node/delete'] = array( 'title' => 'Delete', - 'page callback' => 'ajax_modal_form', + 'page callback' => 'drupal_get_form_modal', 'page arguments' => array('node_delete_confirm', 1), 'access callback' => 'node_access', 'access arguments' => array('delete', 1),