Hello,

I'm a long time user of the flexslider module, typically for simple slideshows. Today, however, I needed to add a carousel as navigation for my slideshow and found it to be slightly cumbersome and error-prone having to hardcode an ID into the optionset settings. It seems to me that it makes more sense to have the navigation carousel auto-generated so that you don't have to manage the IDs yourself. So, my proposal is a few new options to the optionset settings:

  1. Paging Controls: A new "Carousel Navigation" option
  2. Thumbnail Carousel Optionset (dependent field on above option being set): A drop down to select a different optionset to render the carousel navigation.
  3. Thumbnail Carousel Image Style (dependent field on above option being set): A drop down to select an image style to apply to the navigation items.

Then, in the preprocessor for the flexslider theme implementation, we render another flexslider with the provided settings and link it to the main slider as the navigation (and we sync the main slider to the navigation as well).

Attached patch does what I propose above and includes a new entry in the README.md to describe the configuration.

Thanks for your time!
drclaw

Comments

drclaw’s picture

StatusFileSize
new12.43 KB

The last patch had a small error in which the pager was not display in some cases (specifically where it's being rendered twice or more). New patch addresses that issue.

drclaw’s picture

StatusFileSize
new12.99 KB

Okay, third time's a charm. Just one more fix for multiple slideshows with the same settings. Since optionsets are only added to the page once per machine name, we need to make our optionset names unique when they're pager_carousel enabled. Patch attached.

Thanks!

jantoine’s picture

StatusFileSize
new10.68 KB
new5.03 KB

This patch works, but thumbnails were not using the image style selected in the Flexslider optionset. The attached patch generates thumbnail items using the selected image style. I also removed a bunch of unrelated white space changes. An interdiff is attached as well.

dubs’s picture

This is a great patch - thanks :-)

However unfortunately it doesn't work with views. If I have time to solve on this project I'll get back with a patch, but I thought you ought to know.

minoroffense’s picture

Assigned: Unassigned » minoroffense

I'll need to review this in detail. I'll book some time (finally) at the end of August.

jantoine’s picture

StatusFileSize
new587 bytes
new10.68 KB

Small bug fix that was introduced with recent changes to the module.

drclaw’s picture

StatusFileSize
new11.1 KB
new667 bytes

Thanks @jantoine for picking this one up! Quick update to better support using a custom id (instead of the auto-incrementing flexslider counter). Flexslider already supports this, but the navigation was throwing an error because it was looking for the auto-incremented number which isn't used when you use your own id.

seanb’s picture

Seems to work for me! Nice solution. A few remarks:

  1. I have to change line 126 of flexslider.theme.inc from $nav_items = $element[0]['#items']; to $nav_items = $element['#items'];
  2. A typo in the settings pages for the options sets: This option will be ignored if "Thumbnail Carousel" is chosen as the paging control.

Have not tested it with views though. Only in a field formatter.

ConradFlashback’s picture

Patch works in field formatter but not in a views display block.

This is the error:

Notice: Undefined index: item in template_process_flexslider() (line 124 .../sites/all/modules/flexslider/theme/flexslider.theme.inc).

minoroffense’s picture

Status: Needs review » Needs work
jantoine’s picture

@seanB,

I vaguely remember specifically adding the '0' key due to a change in the Flexslider module. Are you using the latest dev?

@ConradFlashback,

This will not work with views because the Flexslider theme function expect an object to be past passed that an image style can be applied to. In the case of views where you can return more than just an image as a slide (i.e. an entire rendered entity), views simply passes the rendered object and doesn't know how to generate a thumbnail from the data.

In light of this, it seems it would be more appropriate for this functionality to be implemented separately for each submodule (views, fields, etc.)

seanb’s picture

Yep, using the last dev. Where you using a fieldset or something that could be adding another level to the element array?

johan den hollander’s picture

StatusFileSize
new10.77 KB

Rerolling the #7 patch. Could not get it to work with composer patching.