Closed (works as designed)
Project:
Drupal core
Version:
7.x-dev
Component:
field system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Mar 2011 at 15:36 UTC
Updated:
21 Sep 2016 at 14:10 UTC
Jump to comment: Most recent
Comments
Comment #1
yched commentedThat's how 'plain text' works.
Newlines in text input are converted into
<br>by the 'linebreak' filter, which therefore only applies within an input format.If the text is a 'plain text', linebreaks are kept as "\n" chars, and are not displayed as linebreaks by the browser.
Line breaks are 'formatting', they require an 'input format'
Comment #2
johnvOK, thanks for explaining.
Comment #3
izkreny commentedHm, if this really works as designed, then I don't get it why when I choose Filtered text (user selects text format) in Text processing for Body field suddenly all Enabled filters for Plain text text format are working in already created content which is using Plain text?! ;)
Also I don't understand why there is possibility to enable filters for Plain text text format if by desing they are supposed to not work?
:confused:
P.S.
I'm using drupal-7.0
Comment #4
davidwhthomas commentedYou can add HTML line breaks to your plain text field output in the field template
e.g
field--field_contact_physical_address.tpl.phpAdding this line
The template file then contains:
There's a probably a better way of doing it in the preprocess function by checking the formatter and changing the value there, but I used the above method as a quick fix.
DT
Comment #5
davidwhthomas commentedClosing as per #1, #3 is a different issue.
Comment #6
star-szrtemplate.php approach to #4 in case anyone else ends up here looking for line breaks with their plain text fields.
Comment #7
loparr commentedhi,
this code is not working for me. I put this code into template.php, changed themename but with no result.
Comment #8
star-szr@loparr - if you mean the code I posted, you will need to change FIELD_NAME as well, perhaps I should have mentioned that.
Also be sure to clear your cache.
Comment #9
loparr commentedOk, that must be it;) will try it . Thank you very much.
Comment #10
leopark commentedyou can set below.
go to Configuration > Text formsts > Plain text > configure > and check Convert line breaks into HTML (i.e. <br> and <p>)
make sure it should be in the last in Filter processing order area
LEO.
Comment #11
jptarantoHere's some updated code that should be fairly generic.
This will add line breaks for ANY long text field that is set as PLAIN TEXT (not filtered text -> plain text).
Comment #12
bpadaria commentedThanks for sharing. #11 works.
Comment #13
Seymour83 commented#11 Thank you!
Comment #14
Helice commented#11 thank you very much!!