Hi There,

I just noticed that the trim option in views didn't really seem to be having an effect on the output. Beginning on line 152 of views_data_export.theme.inc, it looks like it is checking to see whether the option is set in the view and then calls trim if appropriate.

      if (!empty($vars['options']['trim'])) {
        $output = trim($output);
      }

But setting or not setting the option has no effect.

But if I just change line 151 to trim everything:

      $output = trim(decode_entities(strip_tags($value))); // RRCJAB added trim

then it works beautifully (but obviously on all fields instead of just selected ones).

So maybe this is a bug in views? Honestly, I don't know, but I figured I should mention it.

thanks,
John

Comments

drupjab’s picture

Issue summary: View changes

added code example

steven jones’s picture

Status: Active » Needs review
StatusFileSize
new2.42 KB

Add a patch to test CSV trimming

steven jones’s picture

Title: trim not working » Add tests for trim on CSV

Status: Needs review » Needs work

The last submitted patch, views_data_export-trim-not-working-2050867-1.patch, failed testing.

steven jones’s picture

Version: 7.x-3.0-beta6 » 7.x-3.x-dev
steven jones’s picture

Status: Needs work » Needs review
steven jones’s picture

Try again

steven jones’s picture

Status: Needs review » Fixed

Pushed those tests into 7.x-3.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

clarification