I have a text field which I have stored as a piece of custom data in CiviCRM. This is exposed via views and for some (unrelated) reason displays with

tags around it. When I use it as part of a url, embedding it with a replacemtn pattern, I expect this:

/whatever.php?textfield=value

but what I get is:

/whatever.php?textfield=value&textfield=value_

After a lot of poking about if the code, I found the problem in /sites/all/modules/views/handlers/views_handler_field.inc where strip_tags() was leaving whitespace in, that was then getting converted to an underscore by url() (around line 585)

I fixed the problem by inserting this line

$path = trim($path);

at around line 585, leaving it looking like this:

// html_entity_decode removes , so check whether its different to front.
if ($path != '') {
// Use strip tags as there should never be HTML in the path.
// However, we need to preserve special characters like " that
// were removed by check_plain().
$path = strip_tags(html_entity_decode(strtr($path, $tokens)));
$path = trim($path);
}

// If the path is empty do not build a link around the given text and return
// it as is.
if (empty($path)) {
return $text;
}

Comments

Matt Gibson’s picture

That should say 'with \

(paragraph) tags'

dawehner’s picture

Can't you just set up a formatter which returns no html/extra divs? You can use the rewrite feature to achieve this as well if needed.

In views3 for drupal6/drupal7 there is a feature to remove whitespaces.

Matt Gibson’s picture

Still a problem in Drupal 7/Views 3. The 'remove whitespace' option doesn't work, although I haven't tried a formatter.

The new line now needs to be added at line 1076 to fix broken links.

mustanggb’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)