protected AssetResolver::getJsSettingsAssets(AttachedAssetsInterface $assets)
Returns the JavaScript settings assets for this response's libraries.
Gathers all drupalSettings from all libraries in the attached assets collection and merges them.
\Drupal\Core\Asset\AttachedAssetsInterface $assets: The assets attached to the current response.
array A (possibly optimized) collection of JavaScript assets.
protected function getJsSettingsAssets(AttachedAssetsInterface $assets) { $settings = []; foreach ($this->getLibrariesToLoad($assets) as $library) { list($extension, $name) = explode('/', $library, 2); $definition = $this->libraryDiscovery->getLibraryByName($extension, $name); if (isset($definition['drupalSettings'])) { $settings = NestedArray::mergeDeepArray([$settings, $definition['drupalSettings']], TRUE); } } return $settings; }
© 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/core!lib!Drupal!Core!Asset!AssetResolver.php/function/AssetResolver::getJsSettingsAssets/8.1.x