I'm looking at the values of galleria variables on a node I have with two galleria sliders, both using option sets with non "classic" custom themes in their optionsets.

No matter what I do, I cannot get the "theme" value or height/width settings to be anything but what is defined in the "Default" option set.

I checked out the galleria_optionsets table, its accurate. It seems that $optionset is not being populated correctly, so it ends up empty, and ends up defaulting to "default" every time.

$options from option_definition function:
Array
(
[grouping] => Array
(
[default] => Array
(
)

)

[galleria_optionset] => Array
(
[default] => default
)

[galleria_theme] => Array
(
[default] => classic
)

)

$options from option_definition function:
Array
(
[grouping] => Array
(
[default] => Array
(
)

)

[galleria_optionset] => Array
(
[default] => default
)

[galleria_theme] => Array
(
[default] => classic
)

)

vars->settings->optionset array from template_preprocess_galleria_container: (blank)

optionset_name from galleria_optionset_load:
default

optionset from galleria_optionset_load:
Array
(
[name] => default
[title] => Default
[theme] => classic_new
[plugins] => Array
(
)

[imagestyle_thumb] => galleria_thumb
[imagestyle_normal] => slideshow_member_lg
[imagestyle_big] =>
[options] => Array
(
[height] => 300
[width] => 650
)

)

$options from option_definition function:
Array
(
[grouping] => Array
(
[default] => Array
(
)

)

[galleria_optionset] => Array
(
[default] => default
)

[galleria_theme] => Array
(
[default] => classic
)

)

$options from option_definition function:
Array
(
[grouping] => Array
(
[default] => Array
(
)

)

[galleria_optionset] => Array
(
[default] => default
)

[galleria_theme] => Array
(
[default] => classic
)

)

vars->settings->optionset array from template_preprocess_galleria_container: (blank)

optionset_name from galleria_optionset_load:
default

optionset from galleria_optionset_load:
Array
(
[name] => default
[title] => Default
[theme] => classic_new
[plugins] => Array
(
)

[imagestyle_thumb] => galleria_thumb
[imagestyle_normal] => slideshow_member_lg
[imagestyle_big] =>
[options] => Array
(
[height] => 300
[width] => 650
)

)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rconstantine’s picture

Title: Galleria forces "Default" theme, regardless of optionset selection. » Galleria forces "Default" optionset, regardless of optionset selection.

I too have this issue. My custom optionset has a much larger footprint than the default, so it is pretty obvious that it isn't being used anymore. I'm not sure what the date was of the version of this module I originally installed, but I did install it many months ago. Just the other day I updated and now I have this issue.

I investigated a little, then got stuck.

I'm not sure what calls "function template_preprocess_galleria_container(&$vars) {" but the $vars variable lists the 'default' optionset as the one to use. So I know it is something upstream from that.

If you can point me to what comes before that - i.e. where the $vars variable gets set, I can investigate further.

Thanks.

bsandor’s picture

Same issue with 7.x-1.0-beta3 version.

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

simon.westyn’s picture

Issue summary: View changes

added deets to array dump

bmarcotte’s picture

I'm trying to use galleria from code. I found that usage of $vars['settings']['optionset']
should be $vars['settings']['option_set']:

the original post was due to my own mistake; comments have been deleted;
Sorry to confuse,
Bob

bmarcotte’s picture

On a related note, I added a galleria_optionset_load to galleria-container.tpl.php so that the thumbnails would follow the option set settings. Here is the new code.

Bob

<?php
/**
 * @file
 * Default output for a galleria node.
 */
?>
<div class="galleria-content clearfix" id="galleria-<?php print $id; ?>">
<?php
  $optionset = galleria_optionset_load($variables['settings']['optionset']);

  foreach($items as $k=>&$v){
  $v['#image_style']= $optionset['imagestyle_thumb'];
  }

  ?>
  <?php print render($items); ?>
</div>
tstoeckler’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
1.24 KB

So to me it seems that the views plugin stores the optionset in the wrong keys.

Attached patch fixes this for me. Please note that the views that use the Galleria style need to be re-saved.

Also I think the 'galleria_theme' key seems to be unused as the theme is determined by the optionset. I therefore removed that as well.

a.milkovsky’s picture

Status: Needs review » Reviewed & tested by the community

#6 Works for me

a.milkovsky’s picture

Status: Reviewed & tested by the community » Closed (outdated)
FileSize
1.1 KB

Re-rolled #6

a.milkovsky’s picture

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

Restoring status