Closed (fixed)
Project:
Views (for Drupal 7)
Version:
7.x-3.0-alpha1
Component:
fieldapi data
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
13 Jan 2011 at 20:46 UTC
Updated:
27 Feb 2011 at 00:18 UTC
Plain text fields with all english lorem ipsum text gets "ignored" instead of trimmed when set to "Trim to a maximum length", with or without word boundaries checked.
Assigning to myself so I can dig deeper when I find the time.
Comments
Comment #1
phizes commentedI'm not sure this will help anyone.
When I set the max length of trim to be greater than a 133 characters I get the field returned with the number of characters greater than 133 of what I set it to, so if I set it to 150 characters I get 17 characters as the trimmed string. So I'm adding a 133 to what I need for now as a work around.
I haven't tried this with breaking on word boundaries on as my test data was just the long strings from the devel module and I haven't looked further yet.
Comment #2
ephemerol commentedFurther to the above, checking 'Remove all HTML tags' also resolves the issue (tested on Fields: body). Note that preserving HTML tags such as <p> causes no problems.
Comment #3
phizes commentedAfter looking into it further, it seems that HTML tags are being passed to the function that does the trimming of the field on rendering of the page, which I think is creating the 133 character offset. The function that is used to trim the text uses drupal_strlen, if I set the starting point to the second character it breaks the HTML tags, they can then be seen in place of where the field data should be rendered.
There is a TODO in the source to replace most of the function with cleanstring of ctools, I don't think that is related to this problem though.
I haven't found where the "extra" (or more correctly, just in the incorrect place, I think) HTML is being added, and I'm out of time for investigating for now, takes me ages because I haven't looked at views source before. I also have no clue how things are done with views so I think this is as far as I can try help on this one.
Comment #4
qwermans commentedsame error on my site
it works for live preview, then i save. it doesnt work on page.
(i use omega theme)
Comment #5
merlinofchaos commentedThe extra HTML is probably coming from field.tpl.php -- you need to use the -dev version and make sure the box to use field.tpl.php is unchecked. That'll fix this problem.