An odd little bug. I assume its a bug anyway.

If you try and use the Fields->"Trim this field to a maximum length" checkbox in order to only use the Strip HTML tags checkbox under it then you must place a number into the Maximum Length textbox.

Perhaps this is intended as this entire area is designated as the "Trim this field" area. However there could easily be reasons to use the Strip HTML tags feature without needing to trim the length of a field at all.

You can set the Maximum length to 10,000 resulting in no actual trimming and then check off Strip HTML tags.

Would it make more sense to seperate the Strip HTML off into a seperate checkbox away from Trim?

Comments

endiku’s picture

Just realized I wasn't quite clear enough. If you leave Maximum length empty then no stripping occurs at all. So a solution would need to be just more than moving the checkbox but to untie it from Trim in the code needing a length.

Will probably look into it further myself when I get some time.

dawehner’s picture

Status: Active » Needs review
StatusFileSize
new444 bytes

Here is a patch for this :)

merlinofchaos’s picture

StatusFileSize
new3.49 KB

I like this patch a little better. Can someone confirm for me this fixes the problem?

crashtest_’s picture

StatusFileSize
new1.83 KB

Tested, and found that the patch doesn't cover the original poster's issue, that being that regardless of what settings you have applied to other "Trim" settings, if "Strip HTML" is selected, it should strip the HTML.

This patch includes merlin's patch above, so that what he was addressing with it is still being addressed.

crashtest_’s picture

StatusFileSize
new2.75 KB

Addressing some comments in IRC about placement of the strip_tags and removing the Trim dependency on stripping HTML.

crashtest_’s picture

StatusFileSize
new4.66 KB

Because of issue http://drupal.org/node/723286 being closely related, I did a re-roll that incorporates both patches into one. The purpose being that both patches would undo the other patch's change, causing mayhem and panic throughout the land. So, here is a new patch. (this message repeats one time)

dawehner’s picture

StatusFileSize
new4.36 KB

I'm fine with merging the two patches, but:


+  dsm('strlen $value ' . drupal_strlen($value));
+  dsm('max_length ' . $alter['max_length']);
dawehner’s picture

Title: Strip HTML tags won't activate unless Maximum Length set » Move render_trim_text to a reusable drupal_trim_text and Strip HTML tags won't activate unless Maximum Length set

Update title

crashtest_’s picture

Oh darn, sorry about that!

merlinofchaos’s picture

Status: Needs review » Fixed

Committed to all branches. Thanks guys!

merlinofchaos’s picture

Category: bug » task
Status: Fixed » Active

Hm. Somehow I grabbed the one with the dsm in it and applied it.

In any case, I'm reopening this. We shouldn't name it drupal_trim_text() -- that's not our namespace. It should be views_trim_text().

dawehner’s picture

Status: Active » Needs review
StatusFileSize
new948 bytes

Here is a trivial patch

merlinofchaos’s picture

Status: Needs review » Fixed

Committed to all branches.

Status: Fixed » Closed (fixed)

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