Pretty sure you can use views to achieve this.
Sure you can; you can use views to do alot of things - but I don't see how that's relevant to this reequest..
I mean, why not just use a view to create a flexslider block/panelpane or even use a views-field to print it where you want? I just had to do this exact same thing today, that's why I came across your post. Just seems unnecessary to create a module for it... I ended up using a view in a panel pane and it works like a charm, I am using a media field with files, images, youtube and vimeo video's, all displayed in a uniform way through views.
Views adds alot of overhead which is really unnecessary for this simple task.
I mean, the module I created is about 100 lines of code, and would maybe require 50 extra lines of code if it were to be patched into the flexslider_fields module...
I agree it would be a lot more easy if the module provided this functionality :)
I think that we have "simply" to add some code to the module, that now works only for "media" and "image" fields.
Adding "file" is not enough..
I won't be adding this to the module myself. But if someone wants to write the patch I'll be glad to review.
Changed to htmlentities
Here we go.
The attached patch adds a formatter that integrates with file entity view modes.
That way the rendering of the single file item is handled by the file entity module with the file display settings and flexslider fields just takes care of, well, sliding.
This should work with image, media and file fields.
This approach also provides a away to render responsive images with the picture module.
Patch looks good, only found 2 minor code style issues.
+++ b/flexslider_fields/flexslider_fields.module@@ -122,10 +159,17 @@ function flexslider_fields_field_formatter_settings_summary($field, $instance, $+ * Prepares a renderable array of images and adds the necessary JS and CSS
+++ b/flexslider_fields/flexslider_fields.module@@ -147,26 +191,31 @@ function flexslider_fields_field_formatter_view($entity_type, $entity, $field, $+ // If not style set, we have to call theme_image since theme_image_style
Typo: If no style
@attiks Thanks for the review :)
Both comments are adjusted.
Btw. a bit off-topic but is there a reason why we've to render the things to put into $item['slide']?
I think the code would be more "flexible" and thus easier extensible when we would do a render($vars['item']) in theme_flexslider_list_item().
Works for me. RTBC?
Nope. Kept getting the following notice:
Notice: Undefined variable: is in flexslider_fields_field_formatter_settings_summary() (line 134 of /sites/all/modules/flexslider/flexslider_fields/flexslider_fields.module).
The attached patch fixes the issue.
The patch from #12 works. Thank you all very much, it was exactly what I needed.
Would this formatter allow for a mix/choice of
- responsive images (picture)
- video embed
at the same time?
Yes, both responsive images and video embeds are possible with the file entities formatter. The one thing I haven’t been able to do is to make video stills responsive.
I've never applies a patch before, so I might be doing it wrong, but I get an error.
// nevermind, the patch should be run against the dev version. Could have known that..
#12 is working well for me, too. Let's get it committed, please.
Drupal is a registered trademark of Dries Buytaert.