Commit d63c0229 authored by yched's avatar yched

#122797 - views definitions broken - thanks Eaton (followup to #117621)

parent 6f3b379a
...@@ -20,14 +20,17 @@ function content_views_tables() { ...@@ -20,14 +20,17 @@ function content_views_tables() {
if (empty($result)) { if (empty($result)) {
$result = content_views_field_tables($field); $result = content_views_field_tables($field);
} }
$return = array_merge($return, $result); if (is_array($result)) {
$return = array_merge($return, $result);
}
} }
return $return; return $return;
} }
function content_views_field_tables($field) { function content_views_field_tables($field) {
$field_types = _content_field_types();
$db_info = content_database_info($field); $db_info = content_database_info($field);
if (count($db_info['columns'])) { if (count($db_info['columns'])) {
$table = array(); $table = array();
...@@ -141,10 +144,10 @@ function content_views_field_handler_group($field_info, $field_data, $value, $da ...@@ -141,10 +144,10 @@ function content_views_field_handler_group($field_info, $field_data, $value, $da
foreach ($field_info['content_db_info']['columns'] as $column => $attributes) { foreach ($field_info['content_db_info']['columns'] as $column => $attributes) {
$query_columns[] = "node_data_$field[field_name].$attributes[column] AS $column"; $query_columns[] = "node_data_$field[field_name].$attributes[column] AS $column";
} }
$query = "SELECT ".implode(', ', $query_columns). $query = "SELECT ". implode(', ', $query_columns) .
" FROM {node} node". " FROM {node} node".
" LEFT JOIN {". $field_info['content_db_info']['table'] ."} node_data_$field[field_name] ON node.vid = node_data_$field[field_name].vid". " LEFT JOIN {". $field_info['content_db_info']['table'] ."} node_data_$field[field_name] ON node.vid = node_data_$field[field_name].vid".
" WHERE node.nid = ".$data->nid. " WHERE node.nid = ". $data->nid .
" ORDER BY node_data_$field[field_name].delta"; " ORDER BY node_data_$field[field_name].delta";
$result = db_query(db_rewrite_sql($query, 'node')); $result = db_query(db_rewrite_sql($query, 'node'));
while ($item = db_fetch_array($result)) { while ($item = db_fetch_array($result)) {
...@@ -187,12 +190,15 @@ function content_views_arguments() { ...@@ -187,12 +190,15 @@ function content_views_arguments() {
if (empty($result)) { if (empty($result)) {
$result = content_views_field_arguments($field); $result = content_views_field_arguments($field);
} }
$return = array_merge($return, $result); if (is_array($result)) {
$return = array_merge($return, $result);
}
} }
return $return; return $return;
} }
function content_views_field_arguments($field) { function content_views_field_arguments($field) {
$field_types = _content_field_types();
$db_info = content_database_info($field); $db_info = content_database_info($field);
if (count($db_info['columns'])) { if (count($db_info['columns'])) {
$argument = array(); $argument = array();
......
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