/[drupal]/contributions/modules/votesmart/modules/votesmart_field/votesmart_field.module
ViewVC logotype

Diff of /contributions/modules/votesmart/modules/votesmart_field/votesmart_field.module

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

revision 1.2, Sun Aug 10 01:42:52 2008 UTC revision 1.3, Sun Aug 17 15:36:33 2008 UTC
# Line 1  Line 1 
1  <?php // $Id: votesmart_field.module,v 1.1 2008/08/06 05:47:08 vauxia Exp $  <?php // $Id: votesmart_field.module,v 1.2 2008/08/10 01:42:52 vauxia Exp $
2    
3  /**  /**
4   * Implementation of hook_elements().   * Implementation of hook_elements().
# Line 35  function votesmart_field_field_settings( Line 35  function votesmart_field_field_settings(
35    
36        if ($field['type'] == 'votesmart_id') {        if ($field['type'] == 'votesmart_id') {
37          // One id per customer, please.          // One id per customer, please.
38          //$form['multiple'] = array('#type' => 'value', '#value' => 0);          $form['multiple'] = array('#type' => 'value', '#value' => 0);
39    
40          $tables = array();          $tables = array();
41          foreach (votesmart_tables() as $name => $table) {          foreach (votesmart_tables() as $name => $table) {
# Line 134  function _votesmart_field_map_data(&$nod Line 134  function _votesmart_field_map_data(&$nod
134    if (is_array($token)) {    if (is_array($token)) {
135      foreach($token as $col => $tok) {      foreach($token as $col => $tok) {
136        if ($tok && isset($data[$tok])) {        if ($tok && isset($data[$tok])) {
137          $node->{$field_name}[0][$col] = $data[$tok];          if (!is_array($data[$tok])) $data[$tok] = array($data[$tok]);
138            foreach ($data[$tok] as $delta => $value) {
139              $node->{$field_name}[$delta][$col] = $value;
140            }
141        }        }
142      }      }
143    }    }
144    else {    else {
145      if ($token && isset($data[$token])) $node->$field_name = $value;      if ($token && isset($data[$token])) $node->$field_name = $data[$token];
146    }    }
147  }  }
148    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.2