Transforms all JS files into inline JS.

Paramètres

array $js: JS array.

1 call to advagg_mod_inline_js()
_advagg_mod_pre_render_scripts dans advagg_mod/advagg_mod.module
Callback for pre_render to inline all JavaScript on this page.

Fichier

advagg_mod/advagg_mod.module, line 3273

Code

function advagg_mod_inline_js(array &$js) {
    $aggregate_settings = advagg_current_hooks_hash_array();
    foreach ($js as &$values) {
        // Only process files.
        if ($values['type'] !== 'file') {
            continue;
        }
        $filename = $values['data'];
        if (file_exists($filename)) {
            $contents = (string) @advagg_file_get_contents($filename);
        }
        // Allow other modules to modify this files contents.
        // Call hook_advagg_get_js_file_contents_alter().
        drupal_alter('advagg_get_js_file_contents', $contents, $filename, $aggregate_settings);
        $values['data'] = $contents;
        $values['type'] = 'inline';
    }
    unset($values);
}