2

I've created a custom formatter (display) for filefield but I'd like to add a settings page per field for width and height.

Currently my code only consists of the bare minimum to get the formatter to work (which it does). However I'm currently hardcoding width and height at the hook_theme() level.

I've not found any examples of setting pages for formatters only for custom fields. I suspect that it's not possible to do this for a formatter and I'd have to define my own field rather than formatter. I could create a global admin page and loop through all fields and set the settings as a variable but that might become an issue when upgrading it to 7.

Any feedback or ideas would be great.

1
  • can't you just write a hook_form_alter and add your settings to the field settings screen? Mar 29, 2011 at 20:51

2 Answers 2

1

D7 has this baked into the field formatters. You could look at how that is done and emulate it. But I suspect that would be quite a lot of work. How far off is D7 for you? It could be worth waiting till then to allow field settings.

1
  • 1
    It was originally built for a client running D6 so I'd like to get it working in D6 to start with. The width and height can be altered using CSS so I guess I could leave this as is and then do all the fancy stuff for D7
    – digital
    Mar 28, 2011 at 10:14
0

The way imagecache handles it is that you define certain presets through separate configuration and each preset generates a new formatter option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.