Newer
Older
* 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,
);
}
/**
* 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,
);
}