Replace JS key with another key.

Paramètres

array $input: Input array.

array $replacements: Key value pair; key is the new key, value is the old key.

3 calls to advagg_relocate_key_rename()
advagg_relocate_css_alter dans advagg_relocate/advagg_relocate.module
Implements hook_css_alter().
advagg_relocate_css_post_alter dans advagg_relocate/advagg_relocate.module
Alter the css array.
advagg_relocate_js_post_alter dans advagg_relocate/advagg_relocate.module
Alter the js array.

Fichier

advagg_relocate/advagg_relocate.module, line 1330

Code

function advagg_relocate_key_rename(array $input, array $replacements) {
    $output = array();
    foreach ($input as $k => $v) {
        $replacement_key = array_search($k, $replacements, TRUE);
        if ($replacement_key !== FALSE) {
            $output[$replacement_key] = $v;
        }
        else {
            $output[$k] = $v;
        }
    }
    return $output;
}