You are here

function advagg_relocate_key_rename in Advanced CSS/JS Aggregation 7.2

Replace JS key with another key.

Parameters

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 in advagg_relocate/advagg_relocate.module
Implements hook_css_alter().
advagg_relocate_css_post_alter in advagg_relocate/advagg_relocate.module
Alter the css array.
advagg_relocate_js_post_alter in advagg_relocate/advagg_relocate.module
Alter the js array.

File

advagg_relocate/advagg_relocate.module, line 1330
Advanced aggregation relocate module.

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;
}