Skip to content
Snippets Groups Projects
Commit 38abc065 authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #544418 by sun: small follow-up on new AJAX framework.

parent cca5a914
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -24,7 +24,7 @@
* a different callback function to invoke, which can return updated HTML or can
* also return a richer set of AJAX framework commands.
*
* @see ajax_commands
* @see @link ajax_commands AJAX framework commands @endlink
*
* To implement AJAX handling in a normal form, just add '#ajax' to the form
* definition of a field. That field will trigger an AJAX event when it is
......@@ -74,7 +74,7 @@
* be converted to a JSON object and returned to the client, which will then
* iterate over the array and process it like a macro language.
*
* @see ajax_commands
* @see @link ajax_commands AJAX framework commands @endlink
*
* Each command is an object. $object->command is the type of command and will
* be used to find the method (it will correlate directly to a method in
......@@ -179,6 +179,7 @@ function ajax_get_form() {
// system/ajax without actually viewing the concerned form in the browser.
// This is likely a hacking attempt as it never happens under normal
// circumstances, so we just do nothing.
watchdog('ajax', 'Invalid form POST data.', array(), WATCHDOG_WARNING);
exit;
}
......@@ -216,7 +217,8 @@ function ajax_form_callback() {
// If the returned value is a string, assume it is HTML and create
// a command object to return automatically.
if (is_string($html)) {
$commands = array(ajax_command_replace(NULL, $html));
$commands = array();
$commands[] = ajax_command_replace(NULL, $html);
}
// Otherwise, $html is supposed to be an array of commands, suitable for
// Drupal.ajax, so we pass it on as is.
......@@ -333,6 +335,7 @@ function ajax_process_form($element) {
/**
* @defgroup ajax_commands AJAX framework commands
* @{
* @ingroup ajax
*/
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment