web development • design • consulting
This is a complete rewrite of the Brilliant Gallery module. While porting the original module from Drupal 6 to Drupal 7 for a client project I noticed a number of areas that could be improved. As I had time I gradually implemented those improvements and before too long I had rewritten the entire thing. A non-exhaustive summary of changes follows:
- Half as much code to maintain. Because it...
- Uses core image styles instead of custom code to resize images.
- Adds hook_brilliant_gallery_lightbox_info() to allow easy lightbox plugin support (Colorbox, Lightbox2, and Shadowbox are currently included).
- Adopts an OO style to improve organization, improve code reuse, and take advantage of autoloading.
- Allows deletion of galleries and images from the admin interface.
- Uses render arrays. Includes caching of the rendered galleries.
- Adds a gallery field
- Drops custom Views code. Using fields gives us Views support for free.
- Drops Picasa support. This would make more sense in a separate module.
- Backwards compatible with the same bg tags used in 6.x.
- Also supports named tags (e.g. [bg|location=gallery] instead of [bg|gallery]). But...
- Drops support for unnecessary tags: width, columns, and color. Width is replaced by image styles. Columns were only needed when tables were used for layout. This uses floated unordered lists which will automatically flow to fill a given space. If you wish it to fill less space then CSS is the appropriate way to handle that. Color similarly is better handled via CSS.
- Allows recursive galleries, so it will optionally display images within nested directories.
- Allows random galleries.
- A flexible API: calling brilliant_gallery_render($parameters) where $parameters is either a string (a bg tag) or an associative array keyed by tag name will generate a gallery anywhere you call it. You may also create a gallery object directly for more control.