| 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(). |
| 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) { |
| 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 |
|
|