1

I added a Link field to Panopoly's Image fieldable panel pane, but I need to theme it so the link is silently wrapped around the image rather than displayed textually underneath. It also needs to be easily specified by content editors. (Use case: a full-width front page "hero image". Content editors should be able to specify a link for the image.)

How should I go about defining a new kind of Image FPP? Should I define a new view mode? (Since I want editors to be able to use link-wrapped images anywhere, a solution tied to the front page would be too restrictive.)

0

Making a field template file would be easier than defining a new mode I think. That would be the normal way to go about it in Drupal.

In your view under Advanced -> OTHER -> Theme: Information you will find template names for the various fields in increasing granularity. Create a file with the name that best suits your purposes - in this case probably the one that references just the field name and not a specific view or view mode.

Still inside that window, if you click the field name it will show you the default code for the template file, start with that and then edit to your heart's content. I suggest using dpm($output); to inspect the content that is being passed to the template file, and following the suggestions in the code comment provided for your view mode.

[edit: I misread, thought you were somehow using these in views. A template file is still probably the way to go.]

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.