I discovered a number of issues when trying to use Views Slideshow: Galleria's interface to Galleria's extend option. See #936480: Some Galleria options expect JavaScript functions, Drupal.settings gives string for more information. One of these issues is that some options are not passed in the correct type. I'm purposely ignoring the options that are supposed to be output as JavaScript functions: I'll deal with these in another issue as they are more complex.
A list of the options that I am aware are not outputting with the correct data type are:
debug(trueworks, butfalseis output as0)image_crop(trueworks, butfalseis output as0)keep_source(trueworks, butfalseis output as0)popup_links(trueworks, butfalseis output as0)preload(allis output as 0)thumbnails(bothtrueandfalseare output as integers)thumb_quality(bothtrueandfalseare output as integers)
All of these can be demonstrated by following the steps to reproduce in #936480-3: Some Galleria options expect JavaScript functions, Drupal.settings gives string and changing that particular option in step 10.3.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | views_slideshow_galleria-945084.patch | 11.54 KB | mparker17 |
| #4 | views_slideshow_galleria-945084.patch | 6.68 KB | mparker17 |
| #3 | views_slideshow_galleria-945084.patch | 6.68 KB | mparker17 |
Comments
Comment #1
mparker17Inspection of the code shows that there are conditional statements around certain variables to ensure that they are output only when they differ from the default. However, these conditional statements don't seem to work — they all output
0when the current setting matches the default, which results in a number "0" being output in the settings array, rather than not outputting that variable altogether (which would seem to be what the author intended).While I totally like the idea of keeping things clean; I can see a potential maintenance problem with this method of doing things: we're making assumptions about what the defaults are. If Galleria's defaults are changed in a future version of Galleria, this module will start exhibiting unexpected behaviour.
For example, if the Galleria maintainers decide that a default of
keep_source: truewould be easier for developers to understand, the current code will not outputfalse, even if that's what a particular developer wants. Someone would need to change the module.Also note that this module doesn't enforce which version of Galleria is being used. In my fictional example, if someone updated the module to only output
keep_source: false(in reaction to the change to galleria) users who did not update Galleria would start to get unexpected results. In other words, the only way to update the module without side-effects would be to force it to output bothkeep_source: trueandkeep_source: false— in other words, we'd have to drop the conditionals anyway.I want to argue that this is a good reason to drop the conditionals for (at least) the simple options (simple options = ones that don't expect an array or function).
Comment #2
mparker17I also noticed some buggy conditionals on the following options:
carouselqueuethumb_cropComment #3
mparker17Here's a patch. Comments welcome!
Comment #4
mparker17Whoops... copy-paste error. The value
allis valid inpreview. Re-rolling patch...Comment #5
mparker17Update: I accidentally packaged some changes from #945350: Height, width options not available for image_crop, thumb_crop into this patch.
Also, there are a couple of errors in the options that can be more than one type.
Assigning to myself until I can fix it.
Comment #6
mparker17Yay... fixed the problems I am aware of. This patch works and is tested for Galleria at commit cf9ab014d15c41ce89faccb258da6612e677fccf. Comments?
Comment #7
izmeez commentedsubscribing