0

I'm building a custom query plugin for the Views module that uses JSON data from a web API, inspired by this article. I've created a series of field handlers that work fine.

However, I'm struggling with a field that contains an array of image URLs. I've worked out how to return the first image as an HTML <img>, or all of the images as a series of HTML <img>s concatenated together, but what I would like to do is expose the images in such a way that the user can choose how they are formatted (e.g. as a FlexSlider).

When a multi-image field from a Drupal content type is added to a view, the user is presented with a dropdown where they can select a formatter. Ideally I would like my multi-image field to work in the same way.

Does the render() function in the field handler need to return the images in a certain way? Or should I not be using the render() function, seeing as I don't really want to specify how the field should be rendered?

Your Answer

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

Browse other questions tagged or ask your own question.