Hi,

if you add flexslider manually (which is required in some cases where flexslider_add() does not work properly), the for-loop in the following file is a problem, because it assumes, that settings.flexslider exists. It would be more tough, if a check could be added, like:
if(typeof settings.flexslider != 'undefined'){

The JS error without this line:
Error: TypeError: settings.flexslider is undefined
File: ..../sites/all/modules/contrib/flexslider/assets/js/flexslider.load.js?mjwy8f
Line: 8

assets/js/flexslider.load.js:

(function ($) {

// Behavior to load FlexSlider
Drupal.behaviors.flexslider = {
  attach: function(context, settings) {
    var sliders = [];
    for (id in settings.flexslider.instances) {

Result:

(function ($) {

// Behavior to load FlexSlider
Drupal.behaviors.flexslider = {
  attach: function(context, settings) {
    var sliders = [];
    if(typeof settings.flexslider != 'undefined'){
      for (id in settings.flexslider.instances) {        
        if (settings.flexslider.optionsets[settings.flexslider.instances[id]] !== undefined) {
          if (settings.flexslider.optionsets[settings.flexslider.instances[id]].asNavFor !== '') {
            // We have to initialize all the sliders which are "asNavFor" first.

What's your oppinion about that?
Flexslider works absolutely great with this line added and it gives you a lot of flexibility. The possibility to add flexslider manually is also proposed in the README.txt.

Is it worth a patch for a following .dev-release?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gmclelland’s picture

Status: Active » Closed (duplicate)

You might want to check out #1929696: drupal_add_library('flexslider', 'flexslider') no longer works.. I think it is supposed to fix the flexslider_add().

This is also a duplicate of #1938582: Uncaught TypeError: Cannot read property 'instances' of undefined

Please reopen if you feel this is not the case.

gmclelland’s picture

Version: 7.x-2.0-alpha1 » 7.x-2.x-dev
Status: Closed (duplicate) » Needs review
FileSize
1.86 KB

Sorry, your right this is a separate issue that still needs work.

Here is what you suggested in a patch. It fixes the problem for me.

bkonetzny’s picture

Rewritten to use $.type() for type checks and updated attribute removal to chained call.

bkonetzny’s picture

kenorb’s picture

Category: task » bug
Status: Needs review » Reviewed & tested by the community

Tested and it seems to work.

minorOffense’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Committed.

Thanks everyone!

minorOffense’s picture

Issue summary: View changes

Added result code