Closed (fixed)
Project:
Content Construction Kit (CCK)
Version:
6.x-2.6
Component:
General
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
7 Dec 2009 at 20:04 UTC
Updated:
10 Feb 2012 at 00:32 UTC
Hello,
Is there a way to specify a CCK formatter on a node-by-node basis?
That is, I can specify how to display a field for an entire content type, but I want to be able to let a content creator decide which formatter to use for a field when they create a node. My use case is for ImageField/ImageCache, in that I want to allow the content creator to choose the small, medium, or large preset of an image, but I can foresee use cases outside of that for other CCK field types.
If CCK proper can't do this, is there a module that hooks into CCK that can?
Thanks,
Mark Trapp
Comments
Comment #1
markus_petrux commentedYou need to do this using code. One possible approach is that you could create a custom formatter that uses other formatters depeding on the conditions that you may need. See CCK Formatters module to see an example to create a formatter for any field, then in the code of that formatter you need to code.
Comment #2
magnestyuk commented@amorfati, have you found a way to do what you describe?
Comment #3
mark trappI found a solution for my specific use case using ImageCache Actions, which uses a similar solution to what markus_petrux described:
Besides trying to allow the user to get the right size image in a node, I was trying to allow a user to specify one ImageCache preset for a horizontal aspect ratio image upload, and a different ImageCache preset for a vertical aspect ratio image upload. ImageCache Actions has a preset that determines which aspect ratio an image has and executes a preset based on that determination, as well as a custom ImageCache preset that lets me add my own custom logic. Setting the formatter to the ImageCache action allowed the user to get the result they needed without code.
Comment #5
dman commentedOld post, but if you find this by searching (like I did)
D6 Renderer per node
D7 Formatter field