diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/ajax.inc | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/includes/ajax.inc b/includes/ajax.inc index 2fd7f694107..24824a63f3e 100644 --- a/includes/ajax.inc +++ b/includes/ajax.inc @@ -1002,7 +1002,7 @@ function ajax_command_changed($selector, $asterisk = '') { * The 'css' command will instruct the client to use the jQuery css() method * to apply the CSS arguments to elements matched by the given selector. * - * This command is implemented by Drupal.ajax.prototype.commands.insert() + * This command is implemented by Drupal.ajax.prototype.commands.css() * defined in misc/ajax.js. * * @param $selector @@ -1088,6 +1088,37 @@ function ajax_command_data($selector, $name, $value) { } /** + * Creates a Drupal AJAX 'invoke' command. + * + * The 'invoke' command will instruct the client to invoke the given jQuery + * method with the supplied arguments on the elements matched by the given + * selector. Intended for simple jQuery commands, such as attr(), addClass(), + * removeClass(), toggleClass(), etc. + * + * This command is implemented by Drupal.ajax.prototype.commands.invoke() + * defined in misc/ajax.js. + * + * @param $selector + * A jQuery selector string. If the command is a response to a request from + * an #ajax form element then this value can be NULL. + * @param $method + * The jQuery method to invoke. + * @param $arguments + * (optional) A list of arguments to the jQuery $method, if any. + * + * @return + * An array suitable for use with the ajax_render() function. + */ +function ajax_command_invoke($selector, $method, array $arguments = array()) { + return array( + 'command' => 'invoke', + 'selector' => $selector, + 'method' => $method, + 'arguments' => $arguments, + ); +} + +/** * Creates a Drupal AJAX 'restripe' command. * * The 'restripe' command instructs the client to restripe a table. This is |