Elgg  Version 5.1
require_config.js.php
Go to the documentation of this file.
1 <?php
2 
3 $amdConfig = _elgg_services()->amdConfig->getConfig();
4 
5 // Deps are loaded in page/elements/foot with require([...])
6 unset($amdConfig['deps']);
7 
8 // Note we don't process the require() queue yet because it may require('elgg')
9 // and we have to load that synchronously a little later
10 
11 ?>
12 // <script>
13 require = <?php echo json_encode($amdConfig, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); ?>;
14 require.onNodeCreated = function(node, config, module, path) {
15  // SRI is populated on first use and provided by a elgg.data hook callback
16  module = module + '.js';
17  if (elgg.data.sri && elgg.data.sri[module]) {
18  node.setAttribute('integrity', elgg.data.sri[module]);
19  node.setAttribute('crossorigin', 'anonymous');
20  }
21 };
$amdConfig
_elgg_services()
Get the global service provider.
Definition: elgglib.php:346
var elgg
Definition: elgglib.js:4