I’m building a site with a “function” content type, to manage a list of functions and their arguments. Because arguments can be zero or more, and have multiple properties (name, required, usage notes) it seems best to handle them as a field collection, using field collection table as the input widget. Therefore, on the node edit form for the “function” content type, the input widget would look something like this:
On the display side, I need to display the argument data in at least two ways: (1) in a table formatter provided by field collection table and (2) in an arbitrary “syntax” format, where only the arguments are output, but with some kind of visual indication of which arguments are required. So, something like this:
My questions:
-
What’s the best way to add a custom formatter for the field collection (i.e. in code, in a field template of some kind, using the custom formatters module, etc.)?
-
What’s the best way to output two instances of the field collection field, each in a different format?
I do have Display Suite installed on this site, if that helps. Also interested in any general advice if there’s a better way to handle this use case.