Comments

dagomar’s picture

Pretty sure you can use views to achieve this.

bendikrb’s picture

Sure you can; you can use views to do alot of things - but I don't see how that's relevant to this reequest..

dagomar’s picture

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.

bendikrb’s picture

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...

dagomar’s picture

I agree it would be a lot more easy if the module provided this functionality :)

arrubiu’s picture

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..

minorOffense’s picture

Component:Code» Fields Integration

I won't be adding this to the module myself. But if someone wants to write the patch I'll be glad to review.

minorOffense’s picture

Issue summary:View changes

Changed to htmlentities

das-peter’s picture

Issue summary:View changes
Status:Active» Needs review
StatusFileSize
new6.24 KB
Test request sent.
[ View ]

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.

attiks’s picture

Patch looks good, only found 2 minor code style issues.

  1. +++ 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

    Missing dot

  2. +++ 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

das-peter’s picture

StatusFileSize
new6.24 KB
Test request sent.
[ View ]

@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().

Lukas von Blarer’s picture

Works for me. RTBC?

Lukas von Blarer’s picture

StatusFileSize
new6.29 KB
Test request sent.
[ View ]

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.

rolfmeijer’s picture

The patch from #12 works. Thank you all very much, it was exactly what I needed.

groovedork’s picture

Would this formatter allow for a mix/choice of

- responsive images (picture)
- video embed

at the same time?

rolfmeijer’s picture

@groovedork

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.

groovedork’s picture

Issue summary:View changes
StatusFileSize
new55.56 KB

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..

jerry’s picture

Status:Needs review» Reviewed & tested by the community

#12 is working well for me, too. Let's get it committed, please.

jantoine’s picture

StatusFileSize
new5.83 KB
Test request sent.
[ View ]

Re-rolled #12 against the latest dev.

minorOffense’s picture

Status:Reviewed & tested by the community» Needs work

Instead of calling the hook_field_formatter_view in File Entity directly

<?php
    $file_items
= file_entity_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $file_display);
?>

It should be using module_invoke instead. That way other modules can alter (I know right now field_formatter_view doesn't have an alter hook but there's a contrib module that adds one or something apparently). Either way, shouldn't call hook invocations directly.

Also, could you include some docs in the README.md file explaining how to use this and in what cases it makese sense to use it.

Once that's done, I'll give it another look and I think we'll be good to go.

das-peter’s picture

Status:Needs work» Needs review
StatusFileSize
new6.54 KB
Test request sent.
[ View ]
new1.44 KB

@minorOffense Thanks for the feedback.
Here we go, hope the readme addition makes sense.

jerry’s picture

This appears to be working fine for me. Thanks, das-peter.

minorOffense’s picture

Status:Needs review» Fixed

Thanks everyone.

  • minorOffense committed f1dbc3f on 7.x-2.x authored by das-peter
    Issue #1998220 by das-peter, Lukas von Blarer, jantoine: Add a formatter...

Status:Fixed» Closed (fixed)

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