Newer
Older
* An array suitable for use with the ajax_render() function.
*/
function ajax_command_changed($selector, $asterisk = '') {
return array(
'command' => 'changed',
'selector' => $selector,
'asterisk' => $asterisk,
);
}
/**
* Creates a Drupal AJAX 'css' command.
*
* 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.
*

Angie Byron
committed
* This command is implemented by Drupal.ajax.prototype.commands.css()
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
* 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 $argument
* An array of key/value pairs to set in the CSS for the selector.
*
* @return
* An array suitable for use with the ajax_render() function.
*
* @see http://docs.jquery.com/CSS/css#properties
*/
function ajax_command_css($selector, $argument) {
return array(
'command' => 'css',
'selector' => $selector,
'argument' => $argument,
);
}
/**
* Creates a Drupal AJAX 'settings' command.
*

Angie Byron
committed
* The 'settings' command instructs the client either to use the given array as
* the settings for ajax-loaded content or to extend Drupal.settings with the
* given array, depending on the value of the $merge parameter.
*
* This command is implemented by Drupal.ajax.prototype.commands.settings()
* defined in misc/ajax.js.
*
* @param $argument
* An array of key/value pairs to add to the settings. This will be utilized
* for all commands after this if they do not include their own settings
* array.

Angie Byron
committed
* @param $merge
* Whether or not the passed settings in $argument should be merged into the
* global Drupal.settings on the page. By default (FALSE), the settings that
* are passed to Drupal.attachBehaviors will not include the global
* Drupal.settings.
*
* @return
* An array suitable for use with the ajax_render() function.
*/

Angie Byron
committed
function ajax_command_settings($argument, $merge = FALSE) {
return array(
'command' => 'settings',
'settings' => $argument,

Angie Byron
committed
'merge' => $merge,
);
}
/**
* Creates a Drupal AJAX 'data' command.
*
* The 'data' command instructs the client to attach the name=value pair of
* data to the selector via jQuery's data cache.
*
* This command is implemented by Drupal.ajax.prototype.commands.data()
* 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 $name
* The name or key (in the key value pair) of the data attached to this
* selector.
* @param $value

Dries Buytaert
committed
* The value of the data. Not just limited to strings can be any format.
*
* @return
* An array suitable for use with the ajax_render() function.
*
* @see http://docs.jquery.com/Core/data#namevalue
*/
function ajax_command_data($selector, $name, $value) {
return array(
'command' => 'data',
'selector' => $selector,
'name' => $name,
'value' => $value,
);
}

Angie Byron
committed
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
/**
* 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
* usually used after a table has been modified by a replace or append command.
*
* This command is implemented by Drupal.ajax.prototype.commands.restripe()
* defined in misc/ajax.js.
*
* @param $selector
* A jQuery selector string.
*
* @return
* An array suitable for use with the ajax_render() function.
*/
function ajax_command_restripe($selector) {
return array(
'command' => 'restripe',
'selector' => $selector,
);
}