I'm trying to use Flexslider from within my module. Given that I've created an optionset called 'spotlight' and the following HTML:

<div class="spotlight">
<li><img src="" alt="" /></li>
<li><img src="" alt="" /></li>
<li><img src="" alt="" /></li>

How do I enable Flexslider? I tried:

flexslider_add('spotlight', flexslider_optionset_load('spotlight'));

but this doesn't work. It took me a while to figure out that flexslider expects a optionset as Object instead of a string as the documentation suggests. And that ID (although the function accepts NULL), needs to be set even if you only need an optionset. I'd expect the module to work without ID, as I prefer using classes in my HTML instead of ID's. But if this is needed, can you please explain how my HTML should look and how I can load the Flexslider?

Thanks a lot!


minorOffense’s picture

Title: How to use flexslider_add()? » flexslider_add() doesn't accept string name of option set as valid value
Assigned: Unassigned » minorOffense
Category: support » bug

Actually you found half a bug in there. The function should accept a string or the loaded object. (I'll fix that).

The ID is in case of multiple sliders on the same page. But you can always initialize the slider in your own javascript by first calling


And in your theme or js files include something like

minorOffense’s picture

Version: 7.x-1.0-rc3 » 7.x-2.x-dev

I'll consider for v2 to have the element identifier be type agnostic (i.e. classes or ids or whatever).

minorOffense’s picture

Status: Active » Patch (to be ported)

Fixed in latest commit for v2.

minorOffense’s picture

Version: 7.x-2.x-dev » 7.x-1.x-dev
tirdadc’s picture

I'm trying the approach suggested in #1 but it's ignoring all the flexslider settings in the default profile.

minorOffense’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Status: Patch (to be ported) » Fixed

Sadly I haven't had time to fix this in 1.x and I don't think I'll end up doing so. 2.x is stable enough to migrate to.

Status: Fixed » Closed (fixed)

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

  • Commit 617ae3e on 7.x-2.x, youtube, 8.x-2.x, startslide by minorOffense:
    Added fix for issue [#1617734]