/[drupal]/contributions/modules/prepopulate/prepopulate.module
ViewVC logotype

Diff of /contributions/modules/prepopulate/prepopulate.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.11, Mon Jun 23 14:50:42 2008 UTC revision 1.12, Mon Nov 17 17:43:14 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: prepopulate.module,v 1.10 2008/05/03 18:04:54 add1sun Exp $  // $Id: prepopulate.module,v 1.11 2008/06/23 14:50:42 add1sun Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 42  function prepopulate_form_alter(&$form, Line 42  function prepopulate_form_alter(&$form,
42   * @param &$getslice   * @param &$getslice
43   *   String or array. Value(s) to be applied to the element.   *   String or array. Value(s) to be applied to the element.
44   */   */
45  function _prepopulate_get_walk(&$form, &$getslice) {  function _prepopulate_get_walk( & $form, & $getslice) {
46    if (!is_array($getslice)) {    if (is_array($getslice)) {
47      $form['#default_value'] = $getslice;      if (!is_null($form['#default_value'])) {
48    }        if (!is_array($form['#default_value'])) {
49    else {          // Something went wrong so stop here.
50      foreach (array_keys($getslice) as $getvar) {          return;
51        if (element_child($getvar) && is_array($form) && !is_null($form[$getvar])) {        }
52          _prepopulate_get_walk($form[$getvar], $getslice[$getvar]);        $form['#default_value'] = array_merge($form['#default_value'], $getslice);
53        }
54        else {
55          foreach (array_keys($getslice) as $getvar) {
56            if (element_child($getvar) && is_array($form) && !is_null($form[$getvar])) {
57              _prepopulate_get_walk($form[$getvar], $getslice[$getvar]);
58            }
59        }        }
60      }      }
61    }    }
62      else {
63        $form['#default_value'] = $getslice;
64      }
65  }  }

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.2