summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYves Chedemois2008-09-19 19:30:29 (GMT)
committer Yves Chedemois2008-09-19 19:30:29 (GMT)
commitf8120057e9aea5c1d61b7559110f705366623236 (patch)
treeca97c8be58eab82fbc8a19e0c131faeeef275110
parent0bb3edd5c8c72ae0a6cd814bb7dcfe340b7ade70 (diff)
#309365 folowup - merlinofchaos advised a better way.
-rw-r--r--CHANGELOG.txt2
-rw-r--r--includes/views/content.views.inc8
-rw-r--r--includes/views/handlers/content_handler_field.inc11
3 files changed, 7 insertions, 14 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index a883e3d..9039d8d 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -21,7 +21,7 @@ Be sure to visit update.php after uploading this release.
- Views integration : Add default label for userref and noderef relationships.
- #234774 Nifty new UI to add fields and groups (requires a cache clear) + initial integration with advanced_help module.
- #281749 by asimmonds: fix '0' not parsed as an alias for allowed values.
-- #309365 by jhuckabee - Views integration: Consider relationships when force-adding the 'Node: Type' field.
+- #309365 Views integration: Consider relationships when force-adding the 'Node: Type' field - thks jhuckabee.
- #308215 by Reg - Nodereference: Do not filter on empty string when querying for referenceable nodes.
- #308778 Fix $item['view'] element missing for tokens and contemplate.
- #310414 Fix broken redirects when adding fields to content types with an underscore in their machine names.
diff --git a/includes/views/content.views.inc b/includes/views/content.views.inc
index eaa160a..13187c1 100644
--- a/includes/views/content.views.inc
+++ b/includes/views/content.views.inc
@@ -199,10 +199,14 @@ function content_views_field_views_data($field) {
}
}
- $additional_fields = $columns;
+ // Ensure all columns are retrieved,
+ // plus the delta for multiple fields,
+ // plus the node type, that's sometimes used by formatters.
+ $additional_fields = drupal_map_assoc($columns);
if ($field['multiple']) {
- array_push($additional_fields, 'delta');
+ $additional_fields['delta'] = 'delta';
}
+ $additional_fields['type'] = array('table' => 'node', 'field' => 'type');
$data[$columns[0]] = array(
'group' => t('Content'),
diff --git a/includes/views/handlers/content_handler_field.inc b/includes/views/handlers/content_handler_field.inc
index 4a13624..c6bee89 100644
--- a/includes/views/handlers/content_handler_field.inc
+++ b/includes/views/handlers/content_handler_field.inc
@@ -118,15 +118,4 @@ class content_handler_field extends views_handler_field_node {
return $this->render_link(content_format($field, $item, $options['format'], $values), $values);
}
- function query() {
- // Many of our formatters need the node type name, so let's be
- // sure it's in the query.
- // We use the relationship table alias if the field is retrieved
- // through a relationship.
- $relationship = isset($this->options['relationship']) && $this->options['relationship'] !== 'none';
- $table_alias = $relationship ? $this->view->relationship[$this->options['relationship']]->alias : 'node';
- $this->view->query->add_field($table_alias, 'type');
-
- parent::query();
- }
} \ No newline at end of file