ajax_command_settings

function ajax_command_settings

ajax_command_settings($argument, $merge = FALSE)

Creates a Drupal 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 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.

Parameters

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

$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 value

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

Related topics

File

includes/ajax.inc, line 1180
Functions for use with Drupal's Ajax framework.

Code

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!ajax.inc/function/ajax_command_settings/7.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部