Can one use formatters in other formatters. This sounds strange so let me exemplify that:

I've a node with lets say 5 references to other nodes, with different formatters. Those 5 nodes also got references to other nodes with formatters. However, I don't really get how I can get the view of the second reference.

The first reference gives me a 4 elements array with the view string. The second reference only gives me a nid.

... (Array, 4 elements)
      nid (String)
      #delta (Integer)
      view (String)
      empty (Boolean)

Comments

EmilOberg’s picture

Title: Use formatters in formatters? » Formatters with node_load?

Please disregard everything above. I'm claiming temporary coffee loss or something like that ;)

My problem is: When I'm using node_load(), I'm not getting any formatters.

When I'm doing: dsm(node_load(1)), I'm getting:

  • field_reference (Array, 2 elements)
    • 0 (Array, 1 element)
      • nid (String, 2 characters ) 13
    • 1 (Array, 1 element)
      • nid (String, 2 characters ) 14

Where I want to get

  • field_reference (Array, 2 elements)
    • 0 (Array, 1 element)
      • nid (String, 2 characters ) 13
      • view (String, 1024 characters ) <div class="my-sweet-long-lost-formatter...
    • 1 (Array, 1 element)
      • nid (String, 2 characters ) 14
      • view (String, 1024 characters ) <div class="my-sweet-long-lost-formatter...

How can this be solved?

ndeschildre’s picture

Not sure I understand well, but first:

aef_utilities_preview_formatter($node, $formatter_name)
you give a node, and a CCK nodereference formatter name, and you get the node theme with the given formatter. Very useful.

So if you have a node A that contains noderef with formatter selector that points to others node B which themselves contains noderef with formatter selector:

For node B, make a formatter that output the field_noderef[0]['view']

For node A, make a formatter that output the field_noderef[0]['view'], having the formatter above selected.

That should simply make it.