Download & Extend

Decrease the number of field formatters

Project:Lightbox2
Version:7.x-1.0-beta1
Component:Code
Category:feature request
Priority:major
Assigned:Unassigned
Status:patch (to be ported)

Issue Summary

The dubious amount of field formatters for Lightbox2 had been bugging me for quite some while.
I'm talking about the multitude of "lightbox/lightshow__image style__lightbox style" style formatters.
Imagine having 10 image styles (that's not so far fetched, I think). That will lead to no less than a hundred formatters in the display list!

I propose these obviously config level settings to be handled by not additional formatters, but the field_formatter_settings_form hook (as such settings should be).
I've implemented such a single formatter with the ability to configure the following settings per field instance:
- Lightbox type: lightshow or single lightbox.
- Image style: a select list of image styles. What to display as a thumbnail.
- Lightbox style: a select list of image styles. What to display inside the lightbox itself.
- Caption field: a list of image entity fields to choose which field to display as a caption (this one could be later replaced by some more refined display type, e.g. an added 'lightbox' display mode for image file types, etc.).

I've attached a patch including these features, hope it can be ported a.s.a.p.

AttachmentSize
lightbox_field_formatter_settings_implementation.patch7.34 KB

Comments

#1

I fixed a very minor bug in the settings form (double array enveloped options, LOL).
I also attached some screenshots of how the feature works.
Note how where there previously were dozens of formatters, there is now only a single one.
I believe configuring a lightbox2 display with this newly added settings form is much more instinctive to use.

I need feedback on this!

AttachmentSize
lightbox_field_formatter_settings_implementation_1751666_28-08-2012.patch 7.32 KB
lightbox_single_formatter.jpg 91.52 KB
lightbox_settings.jpg 82.27 KB

#2

Great improvement, thank you.

However, the patch didn't apply properly (against 7.x-1.0-beta1):

patching file lightbox2.formatter.inc
patching file lightbox2.module
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n] y
Hunk #1 FAILED at 786.
Hunk #5 FAILED at 1049.
Hunk #6 succeeded at 1065 (offset -3 lines).
Hunk #7 succeeded at 1116 (offset -3 lines).
2 out of 7 hunks FAILED -- saving rejects to file lightbox2.module.rej
nobody click here