I have created a views (display:block) of format galleria that shows one image field of a content node.

The gallery works fine, however, the option set does not appear to loading and/or applying for Galleria when the view is displayed on a page. The galleria slide show loads up and works, but ignores every setting in the option set.

I have set the galleria option set in the node field display options as well as views format settings, *and* the formatter for the field in the view. Am I doing this correctly?

Do option sets work in views (display:block)? If so, is there something additional I need to do in the node or view to have the option set apply? If not, is there javascript that I can use to pass the option values I want into the galleria js?

Thanks!

Comments

daryand’s picture

i am also having this same issue (if my assumptions below are correct):

In "Block -> fields-> Content: image -> link image to: File (or Content)" - nothing happens, behavior does not change.

is there a patch file available somewhere?

ladybug_3777’s picture

I'm having the same issue. Galleria ignores my selected option set when it's being used in a view. It works fine when used on the "manage display" of the page itself.

justinen’s picture

Has anyone found a solution to this issue? I'm experiencing the same behavior when I try to use Galleria module with views. The only option set that takes is the default option set.

simon.westyn’s picture

I fixed this by adding an extra "if" in galleria/theme/theme.inc.
In the template_preprocess_galleria_container function there is an if:

if (!empty($vars['settings']['optionset'])) {
    $optionset = galleria_optionset_load($vars['settings']['optionset']);
}

the problem is that the view doesn't have it's optionset stored in this variable but in

$vars['settings']['galleria_optionset']

But this doesn't completely solve the problem.. Apartently the width and height were passed as string to the JS instead of integer.
To fix this I added 2 lines of code in the function "galleria_add_js" (galleria.module)

$optionset->options['height'] = (int)$optionset->options['height'];
$optionset->options['width'] = (int)$optionset->options['width'];

So, to fix this:
change the following if:

if (!empty($vars['settings']['optionset'])) {
    $optionset = galleria_optionset_load($vars['settings']['optionset']);
}

to:

  if (!empty($vars['settings']['optionset'])) {
    $optionset = galleria_optionset_load($vars['settings']['optionset']);
  }elseif (!empty($vars['settings']['galleria_optionset'])) {
    $optionset = galleria_optionset_load($vars['settings']['galleria_optionset']);
  }

and add

$optionset->options['height'] = (int)$optionset->options['height'];
$optionset->options['width'] = (int)$optionset->options['width'];

in galleria_add_js (galleria.module), above where the $js_settings array is created, like this:

  $optionset->options['height'] = (int)$optionset->options['height'];
  $optionset->options['width'] = (int)$optionset->options['width'];
  // JavaScript settings
  $js_settings = array(
    'themepath' => file_create_url($cache['theme']),
    'optionsets' => array(
      $optionset->name => $optionset->options,
    ),
    'instances' => array(
      'galleria-' . $id => $optionset->name,
    ),
  );
  drupal_add_js(array('galleria' => $js_settings), 'setting');

I hope this will solve your problem :)

jmoyles’s picture

Simon - thanks for the hard work here.