Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
They have the relationship names appended to the beginning. Minor annoyance for me, major annoyance for some people that like to annoy me. Patch below that copies the parent get_field_labels and comments the part that adds the relationship name. In /views_data_export/plugins.
--- ./views_data_export_plugin_display_export.inc.orig 2015-03-24 08:47:08.602105000 -0400
+++ ./views_data_export_plugin_display_export.inc 2015-03-23 17:46:58.884754000 -0400
@@ -803,6 +803,48 @@
return $conn_info['default']['driver'];
}
+ function get_field_labels() {
+ // Use func_get_arg so the function signature isn't amended
+ // but we can still pass TRUE into the function to filter
+ // by groupable handlers.
+ $args = func_get_args();
+ $groupable_only = isset($args[0]) ? $args[0] : FALSE;
+
+ $options = array();
+ foreach ($this->get_handlers('relationship') as $relationship => $handler) {
+ if ($label = $handler->label()) {
+ $relationships[$relationship] = $label;
+ }
+ else {
+ $relationships[$relationship] = $handler->ui_name();
+ }
+ }
+
+
+ foreach ($this->get_handlers('field') as $id => $handler) {
+ if ($groupable_only && !$handler->use_string_group_by()) {
+ // Continue to next handler if it's not groupable.
+ continue;
+ }
+ if ($label = $handler->label()) {
+ $options[$id] = $label;
+ }
+ else {
+ $options[$id] = $handler->ui_name();
+ }
+/*
+ if (!empty($handler->options['relationship']) && !empty($relationships[$handler->options['relationship']])) {
+ $options[$id] = '(' . $relationships[$handler->options['relationship']] . ') ' . $options[$id];
+ }
+*/
+ }
+
+ return $options;
+ }
+
+
+
+
}
class views_data_export_plugin_query_default_batched extends views_plugin_query_default {
Comment | File | Size | Author |
---|---|---|---|
#6 | views_data_export_field_labels-2458357-5.patch | 1.59 KB | imclean |
#3 | views_data_export_header-2458357.patch | 1.59 KB | ayalon |
Comments
Comment #1
davery CreditAttribution: davery commentedI'm making another small change. The labels for excluded fields were showing up in exports, so the data rows would be offset from the correct columns. This fixes that.
Comment #2
agn507 CreditAttribution: agn507 commentedI ran into this same issue today and resolved it by adding
$tag = preg_replace("/\([^)]+\)/","",$tag);
as the first line in the clean_xml_tag function.
This just simply changed a related field label from
(Products referenced by commerce_product) product id
to
product id
Comment #3
ayalon CreditAttribution: ayalon commentedIt's an annoying bug. Added a patch and hope it wil be soon merged.
Comment #4
imclean CreditAttribution: imclean commentedThere are 2 separate issues here:
This is more than a minor annoyance, it makes it unusable for anything more than the simplest of views.
Comment #5
imclean CreditAttribution: imclean commentedComment #6
imclean CreditAttribution: imclean commentedOk I've cleaned up the above patch. Make sure you're using the version from git.
Some info on applying patches here.
Comment #7
imclean CreditAttribution: imclean commented