You are here

public function UltimateCronPlugin::drupal_array_remove_nested_value in Ultimate Cron 7.2

Modified version drupal_array_get_nested_value().

Removes the specified parents leaf from the array.

Parameters

array $array: Nested associative array.

array $parents: Array of key names forming a "path" where the leaf will be removed from $array.

1 call to UltimateCronPlugin::drupal_array_remove_nested_value()
UltimateCronPlugin::cleanForm in ./ultimate_cron.plugin.inc
Clean form of empty fallback values.

File

./ultimate_cron.plugin.inc, line 405
Plugin framework for Ultimate Cron.

Class

UltimateCronPlugin
This is the base class for all Ultimate Cron plugins.

Code

public function drupal_array_remove_nested_value(array &$array, array $parents) {
  $ref =& $array;
  $last_parent = array_pop($parents);
  foreach ($parents as $parent) {
    if (is_array($ref) && array_key_exists($parent, $ref)) {
      $ref =& $ref[$parent];
    }
    else {
      return;
    }
  }
  unset($ref[$last_parent]);
}