0

I'm trying to use a Display Suite field to wrap an image in a div.

What I also want to do is to htmlspecialchars on the token [node:field_mainimage].

It doesn't want to work for me. Is there any other way I can accomplish this?

1

Where are those images placed ?

If this is in content type, you can style the content type content by using custom tpl.php files and wrap your images in div there. (in sites/all/thems/yourtheme , that is.)

Also, you can create template files even for fields.

That gives you enormous power of controlling output :) .

It is bit "dirty", but you can also wrap images in div using jQuery. But first method is cleaner.

  • Well, the wrapping isn't the problem. The problem is that the htmlspecialchars don't do anything. It seems like it tries to work on the [node:field_mainimage] and not on it's value. – Daniel Sep 28 '12 at 13:51
  • If you have nerve to translate your logic from tokens to template files, there you have greater control. If not, some token-experienced user will possibly answer your question. – NenadP Sep 28 '12 at 14:09
0

If you just want wrap image field formatter (html output of field) in another div (or other html containers) I recommend to use Field Group module.

It allows you in formatters configuration (admin/structure/types/manage/*/display) to group any fields and configure to wrap them by basic HTML wrappers, tabs, multistep form etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.