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">
<ul>
<li><img src="" alt="" /></li>
<li><img src="" alt="" /></li>
<li><img src="" alt="" /></li>
</ul>
</div>

How do I enable Flexslider? I tried:

<?php
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!

Comments

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

<?php
flexslider_add
();
?>

And in your theme or js files include something like

$('.my-class').flexslider();

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

Status:Active» Patch (to be ported)

Fixed in latest commit for v2.

Version:7.x-2.x-dev» 7.x-1.x-dev

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

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.