I need help in loading the Flex Slider JS library. The CSS located in drupal_get_path('module', 'flexslider') . '/assets/css/flexslider_img.css loads fine, but there are 2 files that don't load:
libraries_get_path('flexslider') . '/jquery.flexslider-min.js' and
libraries_get_path('flexslider') . '/flexslider.css'

I have used both Flex Slider 7.x-1.x and 7.x-2.x-dev but to no avail.

Got an error when loading the page as well:
Notice: Undefined index: attributes in include() (line 7 of sites/all/modules/flexslider/theme/flexslider.tpl.php).
Recoverable fatal error: Argument 1 passed to drupal_attributes() must be an array, null given, called in sites/all/modules/flexslider/theme/flexslider.tpl.php on line 7 and defined in drupal_attributes() (line 2301 of includes/common.inc).

Also, I have tried to use Drupal default theme and the library still didn't load.

Any suggestions will be appreciated. Thanks.

Members fund testing for the Drupal project. Drupal Association Learn more


minorOffense’s picture

Status: Active » Postponed (maintainer needs more info)

How was the module installed? Did you use a make file? Or did you download the FlexSlider library manually. If so, ensure it's in a folder called "flexslider" in a libraries directory

Ex: sites/all/libraries/flexslider

Be sure to use the latest 2.x version from Github with the 2.x version of the module. FlexSlider 1.0-rc3 only works with version 1.x of the library (specifically 1.8 or higher)

jwilson3’s picture

I was having this same problem, and ended up tracking it down to the (now separate) flexslider_views_slideshow module, which IMHO, is using the "correct" way to load the library (drupal_add_library('flexslider', 'flexslider')... but appearently this method no longer works with the flexslider module,

I replaced drupal_add_library('flexslider', 'flexslider'); with flexslider_add() and it worked flawlessly.

Note: running latest dev versions of libraries, flexslider and flexslider_views_slideshow modules.

I don't know what the tradeoff is, or why flexslider doesnt properly load using drupal_add_library(), but perhaps this is something to investigate.

minorOffense’s picture

Title: Flexslider library doesn't load » drupal_add_library('flexslider', 'flexslider') no longer works.
Category: support » bug
Status: Postponed (maintainer needs more info) » Active

We switched to using the hook_libraries_info (as part of the Libraries 2.x) module which is what D8 will be using. Meaning I should update the docs to read "use libraries_load('flexslider')" instead. But you're right, drupal_add_library should still work.

I'll see about reintroducing the basic hook_library which would allow you to include the library as expected.

minorOffense’s picture

Or a patch is always welcome ;-)

jwilson3’s picture

Category: bug » support
Status: Active » Postponed (maintainer needs more info)

Thanks for fast response, I dont have time at the moment to prepare a proper patch to add back the hook_library support because I'm preparing now a presentation to be given this week on how to build a responsive slideshow with flexslider, views_slideshow and the bean module.

It would be super cool if the latest dev versions were actually working without needing patches for this presentation, but if not, no big deal. I can provide the one-liner patch to flexslider_views_slideshow for my workaround in #2 if you wish.

jwilson3’s picture

Category: support » bug
Status: Postponed (maintainer needs more info) » Active


jwilson3’s picture

Looking at the code in _flexslider_views_slideshow_preprocess_flexslider_views_slideshow_main_frame it looks like there is logic for an optionset, so maybe passing that to flexslider_add() *would* be the proper way to do this... I'm not entirely clear. It looks like some of the optionset logic for the views_slideshow integration really hasn't been built out yet completely, so its really hard for me to tell what would be the proper solution.

jwilson3’s picture

Actually, you know what, I do need the hook_library functionality after all, unless there is an alternative way to make hook_library_alter() work.

In a custom feature where all the views and flexslider configs are exported, I'm using hook_library_alter(), to swap out the flexslider.css file with a modified version of my own, and without hook_library() this has pretty much ceased to work.

 * Implements hook_library_alter().
function my_feature_library_alter(&$libraries, $module) {
  // Use our own flexslider.css
  if ($module == 'flexslider' && isset($libraries['flexslider'])) {
    $libraries['flexslider']['css'] =  array(
      drupal_get_path('module', 'my_feature') . '/css/flexslider.css' => array(
        'type' => 'file',
        'media' => 'screen',

This will have to be rewritten to use hook_libraries_info_alter instead.
UPDATE: I was able to rewrite this with hook_libraries_info_alter with relative ease.

 * Implements hook_libraries_info_alter().
function my_feature_libraries_info_alter(&$libraries) {
  // Use our own flexslider.css
  if (isset($libraries['flexslider'])) {
    $libraries['flexslider']['integration files']['my_feature'] =  array(
      'css' => array('css/flexslider.css')

Out of curiosity, what features of the libraries module were needed that the current core D7 library functionality didn't support?

minorOffense’s picture

The big one being Libraries' capacity to find the library in either the sites folder, sites/all or an install profile library folder. There are also lots of options regarding library version numbering, dependencies on specific library versions, etc...

I've got plans to use a good portion of those in the future. Especially as the flexslider library itself is updated/modified. Essentially future proofing the module.

jwilson3’s picture

If you decide not to add the core library implementation back to regain the drupal_add_library() functionality, you should also update the project page, which currently has broken instructions:

As a library to be used with any other theme or module by calling drupal_add_library('flexslider', 'flexslider')

minorOffense’s picture

Status: Active » Needs review
3.46 KB
None View

Here's a patch, care to test it out for me?

jwilson3’s picture

cool thanks for the update, I'm currently on vacation, so can't promise anything until after easter, but will add it to my todo list to check when i get back.

deggertsen’s picture

Well, whatever that patch does it made it so flexslider actually works now. It wasn't working at all before applying the patch and I suspected something wasn't working right with the library integration so I figured I would test this patch and sure enough it works. So thank you!

gmclelland’s picture

Patch in #11 - fixed my issue with flexslider_add() not working when you want to load only the library files manually in your theme.

Tritof’s picture

Patch in #11 works for me.

jwilson3’s picture

Status: Needs review » Needs work
+++ b/flexslider.moduleundefined
@@ -4,6 +4,9 @@
+define("FLEXSLIDER_VERSION", variable_get('flexslider_version', '2.0'));
+define("FLEXSLIDER_DEBUG", variable_get('flexslider_debug', FALSE));

Not 100% sure on this, but this piece of code doesn't seem correct. Usually define() is used when you're hardcoding a value, not pulling it from the database. If my understanding is correct you should remove these two lines, and replace all instances of FLEXSLIDER_DEBUG or FLEXSLIDER_VERSION with variable_get().

giupenni’s picture

Patch #11 no works for me.

I have already open a issue http://drupal.org/node/1954886 , I don't know if is it related.

erin814’s picture

Patch #11 didn't work for me. I'm able to see the slideshow in the Views preview but it doesn't show on the live site.

EDIT: I was calling jQuery twice on the live site. Fixed.

orbistertius’s picture

#18 Could you please explain how you solved it?

erin814’s picture

Shoot it's been a while and I can't quite remember. I think that I was calling the jQuery library in my html.tpl.php file which was a remnant from the previous slideshow I was using, so I removed that and it worked.

There's also the jQuery Update module that will call jQuery once and you can also set which version of jQuery to use: https://drupal.org/project/jquery_update but I was getting AJAX errors in Views for some reason. It might work for you though.

minorOffense’s picture

Status: Needs work » Closed (fixed)

Committed #11

stinky’s picture

#11 doesn't work for me. I still get "FlexSlider library not found." in the status report.

giupenni’s picture

Is it fixed in 7.x-2.x-dev?

stinky’s picture

No. I just installed 7.x-2.x-dev and am still getting
FlexSlider library not found. Please consult the README.txt for installation instructions.

stinky’s picture

Issue summary: View changes

Additional error info

nessunluogo’s picture

Issue summary: View changes

With 7.x-2.x-dev and latest Flex Slider library (2.6.0 while I'm writing) the problem is still there.
Using the previous version of the library (2.5.0) seems a fast workaround.

giupenni’s picture

I'm using latest dev and 2.6.0 library and seems works as I expected.
Are you sure to use JQuery 1.7+ ?

nessunluogo’s picture

I missed that requirement! I'm sure giupenni mean jQuery version 1.7+

Lusha_MHI’s picture

I am still having a problem here, I have an updated JQuery, have installed the libraries of both flexslider and libraries API 2, have installed the module, Made sure all of it's dependancies are there and enabled, and it still yells at me. However, It still shows up in configuration, so for now I will ignore it.

However, On a note, if I am to use a patch, Where the heck do I put it? Litterally all I have is an FTP log in and am on windows. I don't know what Drush is, though it appears it is a mac thing...

UPDATE: I dont know is Jquery plug in has anything to do with it, (Though I would assume so, but I will update and make sure that is where it needs to be there. )
Any information on patches would still be appreciated.

jomarocas’s picture

ok i see very lot of people dont working, and the maintainer tells working, i use latest version of flexslider.2.0rc1 and i use 2.6 version of plugin i supose is the plugin, i install the flexslider in libraries. sites/all/libraries/flexslider and two files


and tells missing flexslider library.

and the only solution is add development library, please update the readme file


Adrião Neves’s picture

I had this issue and in my case it was related with folder permissions: https://www.drupal.org/node/1351350#comment-6009420