The attached patch adds an nl2br option to the field configuration of Views.

Situation:
* one cck text area using plain text added to my node type
* newlines are presented as br tags on the node page
* Using the same field in a view just pints the newlines, letting HTML ignore them

I know that this presentation issue could also be solved by using filtered text instead.
But the added overhead does not seem worth it as it would also make me dependent on better_formats.

The patch works for both 2.x-dev and 3.x-dev

Comments

dawehner’s picture

Status: Active » Needs review

Update status

dawehner’s picture

It would be cool to provide a link to php.net so the user can inform what nl2br does.

helmo’s picture

StatusFileSize
new1.97 KB

Good point, I added the php.net link to the patch.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Even i don't understand why you have to add target blank, the rest looks fine.

helmo’s picture

If the target attribute were absent the php.net page would be loaded in the same window. Thus losing the current drupal page.

dawehner’s picture

Personally people should be intelligent enough to use tabs.
Additional target isn't XHTML strict.

helmo’s picture

StatusFileSize
new1.96 KB

In my case Firefox is clever enough to know I prefer them in a new tab.

But as for the xhtml strict spec... I've removed the target attribute from the patch.

What do you think about the rest of this patch?

merlinofchaos’s picture

Status: Reviewed & tested by the community » Needs work

There's no need to expose nl2br() at all to the user. Telling them we'll convert newlines to br tags is good enough.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new1.63 KB

Remove the comment about nl2br

helmo’s picture

Status: Needs review » Reviewed & tested by the community

@merlinofchaos: I can understand that we should not overload the user with extra info.

merlinofchaos’s picture

Status: Reviewed & tested by the community » Fixed

Committed to D6-3.x and D7-3.x

Status: Fixed » Closed (fixed)

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