You are here

public function CronPlugin::drupal_array_remove_nested_value in Ultimate Cron 8.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 CronPlugin::drupal_array_remove_nested_value()
CronPlugin::cleanForm in src/CronPlugin.php
Clean form of empty fallback values.

File

src/CronPlugin.php, line 162

Class

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

Namespace

Drupal\ultimate_cron

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