SettingsCommand

AJAX command for adjusting Drupal's JavaScript settings. The 'settings' command instructs the client either to use the given array as the settings for ajax-loaded content or to extend drupalSettings with the given array, depending on the value of the $merge parameter. This command is implemented by Drupal.AjaxCommands.prototype.settings() defined in misc/ajax.js. Hierarchy class \Drupal\Core\Ajax\SettingsCommand implements CommandInterface Related topics Ajax API Overview for Drupal's Ajax A

SettingsCommand::$merge

Whether the settings should be merged into the global drupalSettings. By default (FALSE), the settings that are passed to Drupal.attachBehaviors will not include the global drupalSettings. Type: bool File core/lib/Drupal/Core/Ajax/SettingsCommand.php, line 37 Class SettingsCommand AJAX command for adjusting Drupal's JavaScript settings. Namespace Drupal\Core\Ajax Code protected $merge;

SettingsCommand::render

public SettingsCommand::render() Implements Drupal\Core\Ajax\CommandInterface:render(). Overrides CommandInterface::render File core/lib/Drupal/Core/Ajax/SettingsCommand.php, line 55 Class SettingsCommand AJAX command for adjusting Drupal's JavaScript settings. Namespace Drupal\Core\Ajax Code public function render() { return array( 'command' => 'settings', 'settings' => $this->settings, 'merge' => $this->merge, ); }

SettingsCommand::$settings

An array of key/value pairs of JavaScript settings. This will be used for all commands after this if they do not include their own settings array. Type: array File core/lib/Drupal/Core/Ajax/SettingsCommand.php, line 27 Class SettingsCommand AJAX command for adjusting Drupal's JavaScript settings. Namespace Drupal\Core\Ajax Code protected $settings;

SettingsCommand::__construct

public SettingsCommand::__construct(array $settings, $merge = FALSE) Constructs a SettingsCommand object. Parameters array $settings: An array of key/value pairs of JavaScript settings. bool $merge: Whether the settings should be merged into the global drupalSettings. File core/lib/Drupal/Core/Ajax/SettingsCommand.php, line 47 Class SettingsCommand AJAX command for adjusting Drupal's JavaScript settings. Namespace Drupal\Core\Ajax Code public function __construct(array $settings, $mer

Settings::__construct

public Settings::__construct(array $settings) Constructor. Parameters array $settings: Array with the settings. File core/lib/Drupal/Core/Site/Settings.php, line 35 Class Settings Read only settings that are initialized with the class. Namespace Drupal\Core\Site Code public function __construct(array $settings) { $this->storage = $settings; self::$instance = $this; }

Settings::getInstance

public static Settings::getInstance() Returns the settings instance. A singleton is used because this class is used before the container is available. Return value \Drupal\Core\Site\Settings File core/lib/Drupal/Core/Site/Settings.php, line 48 Class Settings Read only settings that are initialized with the class. Namespace Drupal\Core\Site Code public static function getInstance() { return self::$instance; }

Settings::initialize

public static Settings::initialize($app_root, $site_path, &$class_loader) Bootstraps settings.php and the Settings singleton. Parameters string $app_root: The app root. string $site_path: The current site path. \Composer\Autoload\ClassLoader $class_loader: The class loader that is used for this request. Passed by reference and exposed to the local scope of settings.php, so as to allow it to be decorated with Symfony's ApcClassLoader, for example. See also default.settings.php File core/li

Settings::__clone

private Settings::__clone() Protects creating with clone. File core/lib/Drupal/Core/Site/Settings.php, line 55 Class Settings Read only settings that are initialized with the class. Namespace Drupal\Core\Site Code private function __clone() { }

Settings::__sleep

public Settings::__sleep() Prevents settings from being serialized. File core/lib/Drupal/Core/Site/Settings.php, line 61 Class Settings Read only settings that are initialized with the class. Namespace Drupal\Core\Site Code public function __sleep() { throw new \LogicException('Settings can not be serialized. This probably means you are serializing an object that has an indirect reference to the Settings object. Adjust your code so that is not necessary.'); }