Using views in cck formatters

igor.ro's picture

In my last project I develop module that may be intersted to community.
The problem was that I need to show list of images (imagefield) from nodes (type A) that references to node (type B) in on full node view page in the node body region. Also I was need to show list of nodes (type C) that have same taxonomy as current viewed node.

The decigion was to run view in the formatter code for nodereference field and to pass in this view value of this field as argument.
What do you think about this solution?

Because it was need to have several formatters for different fields with different theming, I create a BO for this module.

So if you need to use view as formtter for some cck field you need.

1) Create view with argument that will get value of field.
2) Create a new formatter in BO. Set user-readeble name, machine name, set view/display to use, set operation for multivalues fields (for example merge values with '+').
3) Apply formatter in display content type page.
4) Theme view to be like on slice.

What do you think about this functionality?
Do you have same tasks in your project?
Do you think this module will be usefull for community?
Do you know other module where I can add this code as a feature?

Thanks.

Login to post comments