hook_js_settings_build

hook_js_settings_build(array &$settings, \Drupal\Core\Asset\AttachedAssetsInterface $assets)

Modify the JavaScript settings (drupalSettings).

The results of this hook are cached, however modules may use hook_js_settings_alter() to dynamically alter settings.

Parameters

array &$settings: An array of all JavaScript settings (drupalSettings) being presented on the page.

\Drupal\Core\Asset\AttachedAssetsInterface $assets: The assets attached to the current response.

See also

\Drupal\Core\Asset\AssetResolver

Related topics

Hooks
Define functions that alter the behavior of Drupal core.

File

core/lib/Drupal/Core/Render/theme.api.php, line 906
Hooks and documentation related to the theme and render system.

Code

function hook_js_settings_build(array &$settings, \Drupal\Core\Asset\AttachedAssetsInterface $assets) {
  // Manipulate settings.
  if (isset($settings['dialog'])) {
    $settings['dialog']['autoResize'] = FALSE;
  }
}
doc_Drupal
2016-10-29 09:18:18
Comments
Leave a Comment

Please login to continue.