function realname_array_set_nested_value in Real Name 6
Backport of the drupal_array_set_nested_value() function from Drupal 7.
1 call to realname_array_set_nested_value()
- realname_form_alter in ./realname.module 
- Implements hook_form_alter(). Intercepts the contact forms to show the realname.
File
- ./realname.module, line 989 
Code
function realname_array_set_nested_value(&$array, $parents, $value, $force = FALSE) {
  $ref =& $array;
  foreach ($parents as $parent) {
    // PHP auto-creates container arrays and NULL entries without error if $ref
    // is NULL, but throws an error if $ref is set, but not an array.
    if ($force && isset($ref) && !is_array($ref)) {
      $ref = array();
    }
    $ref =& $ref[$parent];
  }
  $ref = $value;
}