CCK provides 3 contexts for which different formatters can be selected. FileField's dynamic formatters should do the same. The attached patch is a bumbling attempt at just such a feature. :) I hope it can be a foundation to keep the feature set we get with CCK's formatter system, until we can develop as UI. An extension to the Concept may be to rewrite the CCK Display Settings form to set #type to hidden and set the formatters for each context explicitly and present a like to the field settings form instead of the preset select on the Display settings form...

Alternatively a meta-formatter.module would be nice as well.

Comments

jpetso’s picture

I'm currently working on a patch that moves the file formatter settings out of the field and into a separate admin form for managing file formatter presets. This should fix this issue as well as #277895: Teaser vs. Page aware formatters, #276967: display settings in the wrong place? and filefield_image's #276551: Ability to choose different file formatters in Views.

Not sure if a quick fix like this is the best solution - most importantly, this patch still doesn't make it possible to have different formatter settings for a multitude of different views.

dopry’s picture

If we at least get a neater UI, I can work on the views stuff later... :) I wasn't aware that you had started when i was tinkering last night.

jpetso’s picture

StatusFileSize
new35.04 KB

Ok, here's a working patch, stealing big time from imagecache's preset, menu and form code. It probably needs some cross-linking for better usability (from/to the "Display fields" and "FileField formatters" admin pages, and probably also from the field configuration form), and also needs a more thorough review than the short glimpse that I gave it just now, but apart from those minor points it seems to work pretty decently.

You might want to give it a shot, otherwise I'll probably commit it in the following few days with nicer messages but with unchanged inner workings.

dopry’s picture

Is there anyway we can leverage CCK's hook_formatter_info instead of adding the new formatter hook for filefield? I think you could add the extra properties to the array without CCK freaking out...

Do you think this could become a more general metaformatter module, and could work with CCK core by merging the field_types properties of the included formatters. It would give users the ability to write more advanced formatters for all CCK fields, not just filefield... just a thought, but we can start with filefield.

dopry’s picture

StatusFileSize
new25.53 KB

Hey that didn't commit to head.. attached is an re-rolled version, but something about the unserialize seems broken... maybe you can take a look and see if you can figure it out.. maybe upgrade path error.

dopry’s picture

Status: Needs review » Needs work

oh yeah...

roam2345’s picture

subscribe.

wuf31’s picture

subscribe.

dopry’s picture

Status: Needs work » Closed (fixed)

This patch is being replaced by a metaformatter module..

roam2345’s picture

Where can we get our hands on this? Or is it still to early?

Regards,
Lathan