Commit 421f5ada authored by yched's avatar yched

#151347 - refactor content_field('load') to make it more legible

parent 82f0ec31
......@@ -400,17 +400,16 @@ function content_field($op, &$node, $field, &$node_field, $teaser, $page) {
foreach ($db_info['columns'] as $column => $attributes) {
$column_names[] = $attributes['column'] .' AS '. $column;
}
$query = 'SELECT '. implode(', ', $column_names) .' FROM {'. $db_info['table'] .'} WHERE vid = %d';
if ($field['multiple']) {
$result = db_query('SELECT '. implode(', ', $column_names) .' FROM {'. $db_info['table'] .'} WHERE vid = %d ORDER BY delta', $node->vid);
$values = array();
while ($value = db_fetch_array($result)) {
$values[] = $value;
}
$additions = array($field['field_name'] => $values);
$result = db_query($query .' ORDER BY delta'. $compl, $node->vid);
}
else {
$result = db_query('SELECT '. implode(', ', $column_names) .' FROM {'. $db_info['table'] .'} WHERE vid = %d', $node->vid);
$additions = array($field['field_name'] => array(db_fetch_array($result)));
$result = db_query_range($query, $node->vid, 0, 1);
}
$additions = array();
while ($value = db_fetch_array($result)) {
$additions[$field['field_name']][] = $value;
}
return $additions;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment