The attached patch refactors theme_image_gallery() to allow for easier theming by pulling the code for creating the html for 1 image into its own theme_image_gallery_img() function.
Comments?
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | image_gallery-theme-2.patch | 2.67 KB | ray007 |
| image_gallery-theme-1.patch | 2.79 KB | ray007 |
Comments
Comment #1
drewish commentedi think it's a good change. i'll commit it with a few tweaks. rather that having a static size variables in theme_image_gallery_img(), i'd rather pass $size in as a parameter. also is there a reason that $image is being passed by reference?
Comment #2
ray007 commentedOld habits die hard?
I think I've read passing object by reference improves performance, no?
Feel free to change the signature to pass the size as parameter, but I thought the overwriting theming function may want to use another preset size, ignore this size, ... and can get it if wanted. It seemed special to the default theming, and not something we want as parameter, but I may be wrong here ;-)
Comment #3
drewish commentedi don't believe it makes any appreciable difference and but it sends an incorrect message that the theme function may be modifying the image object.
there are a few reasons for passing the size:
* it's cleaner cleaner than having to have the statics and code to detect and set the variables.
* i think the size information would be useful in the general case and it's much easier to ignore the information than it is to have every implementing function have to load it.
i don't really have time to work on this right now so but if you'd re-roll a patch, i'll commit it.
Comment #4
ray007 commentedAll right, here a new version of the patch with $size as additional parameter to theme_image_gallery_img(). Or would you prefer separate $width and $height parameters?
Comment #5
drewish commentedgreat, committed this to HEAD and DRUPAL-5.
Comment #6
ray007 commentedMaybe the following little patch would improve performance a bit:
patch is on top of what you already commited.
Comment #7
drewish commentedthat's a good idea, i'll probably rename $tfunc to $function. i'll get this committed on monday.
Comment #8
sunSorry, 5.x-1.x won't see any new features.