Use of inline css such as style="background: #f00; etc is stripped from global text on render. I was hoping to use a replacement value to allow me to apply a cck field image url as the background of a div via an inline style but found any and all style attributes stripped from the div on render.

Screenshot attached of example.

CommentFileSizeAuthor
2011-02-28_1425.png54.39 KBMatt Giacomazzo

Comments

dawehner’s picture

Currently this is stripped out.

We might support input formats there.

In the meantime you can use http://drupal.org/project/views_customfield to provide any kind of output.

iamjon’s picture

Status: Active » Closed (works as designed)

Marking as closed as workaround offered.

jdln’s picture

Status: Closed (works as designed) » Active

I need to do the same thing but when I use Views Custom Field the exact same thing happens. Ive tried Markup and PHP code.

Thanks

dawehner’s picture

Status: Active » Fixed

Okay then please use .css files and classes.
if you really need it you can use field templates.

jdln’s picture

So this can't be done with Views Custom Field? I can do it with template but keeping everything in the UI would be a bit easier.

merlinofchaos’s picture

Issue tags: -CSS

No you cannot, for security reasons. You can with Views PHP Field module.

jdln’s picture

Do you mean the PHP code field for the Views Custom Field module? This doesn't seem to work for me.
Thanks

Status: Fixed » Closed (fixed)

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

jason@greengeckodesign.com’s picture

Version: 6.x-2.9 » 7.x-3.0-rc1
Status: Closed (fixed) » Needs review

So if we want to inject a little inline css (in situations where a class won't cut it because we are using user generated content such as a color or image) our only choice (sort of writing our own handler) is to use Views PHP? Doesn't that create a security risk?

dawehner’s picture

Status: Needs review » Fixed

Well, noone forces you to use views php.

You can always use the real views api and write your own handler.

But you are right the global: custom field will always strip css, because if it's not done, this is a security risk.

Status: Fixed » Closed (fixed)

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