Further to the question I raised in this post http://drupal.org/node/1895180, I have run into issues with the output of the node.

In the comment I added at 5:01 January 22, I mentioned the idea of multiple data elements being displayed on the page. I have the sql that correctly pulls out the nodes of the right type that are tagged with the right taxonomy term, and joins the node data to them. My issue now is displaying these items on the page with the "one at a time" data.

I have added code to hook_view in my module, as far as I can tell I put data into $node->content. I have done this with the static field title, I am at a loss as to how I should add data to the '#items' of the field structure. The documentation mentions using hook_field_formatter_view but, how do I use that for a content_type that is defined in the UI? I would like to use a teaser view of the "sub nodes" in this situation with the titles and links all set up as they would normally be. I know could write the html into the content field directly but this does not seem to be the right way of doing things, especially as the "body" field also seems to be rendered by the field api at some time after this.

Any ideas would be great at this point as the documentation is not very clear around this area and I am drawing a blank :(
Thanks
Anthony

Comments

Have you looked at the eva

Have you looked at the eva module?

I took a quick look and I

I took a quick look and I don't think it will work, the taxonomy term for the search is dependent on the node being looked at.

For an example, imagine a restaurant review site, clicking on the restaurant shows the restaurant node complete with the static data (address etc) and includes the last 5 reviews entered for that restaurant. While I can add a view with the last five reviews on it, I cannot see how I can automatically restrict the list to the last five reviews for this restaurant.

I believe you can use Views

I believe you can use Views Node Taxonomy Filter to get the filter you need.

I would have used an entity reference field in the review content type to provide a more direct relation.

This does not seem to do what

This does not seem to do what I need, the taxonomy term I am searching for does not exist until after the root node is created which means that after creating the restaurant node it would be necessary to edit it and set the taxonomy. If I can just add the data programmatically in hook_view, the problem just goes away.

I am still struggling with

I am still struggling with this. I have my field title showing, but I can't populate it with a list of the last 5 reports. I am currently using this in my hook_view (athlete_view)

    $node->content['field_training'] = array(
     '#theme' => 'field',
     '#title' => t('Training Reports'),
     '#weight'=>10,
     '#label_display' => 'above',
     '#entity_type' => 'training_report',
     '#field_name' => 'field_training',
     '#field_type' => 'long_text',
     '#formatter' => 'html',
     '#bundle' => 'athlete',
     '#cardinality' => 5,
     '#items' => array(),
         )

To make the field.

I then run my query to pull in the training reports, based on the taxonomy term that is associated with this athlete. At the moment, the query returns one node id, which I pass to node_load to get the data from the database, then I want to use this object to create the data for this field.

The issue lies in that I don't know exactly what '#items' is supposed to be, I have even tried plugging the results of node_view() from the loaded node into it to no avail.

I have researched the modules recommended above extensively and the don't satisfy what I need. training reports are only the start of the necessary additional data, but I am hoping that once I get them working, I can "rinse and repeat" for the other fields.