1 ajax.inc ajax_command_settings(array $argument, $merge = FALSE)

Creates a Backdrop Ajax 'settings' command.

The 'settings' command instructs the client either to use the given array as the settings for ajax-loaded content or to extend Backdrop.settings with the given array, depending on the value of the $merge parameter.

This command is implemented by Backdrop.ajax.prototype.commands.settings() defined in misc/ajax.js.

Parameters

array $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.

bool $merge: Whether or not the passed settings in $argument should be merged into the global Backdrop.settings on the page. By default (FALSE), the settings that are passed to Backdrop.attachBehaviors will not include the global Backdrop.settings.

Return value

array: An array suitable for use with the ajax_render() function.

Related topics

File

core/includes/ajax.inc, line 1242
Functions for use with Backdrop's Ajax framework.

Code

function ajax_command_settings(array $argument, $merge = FALSE) {
  return array(
    'command' => 'settings',
    'settings' => $argument,
    'merge' => $merge,
  );
}