Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Right now if you want to put customize your node template, you need to find $node->content[view_display_id]['#value'].
It would be cool to have the output automatically exposed in template variables, like CCK does with $FIELD_NAME_rendered variables.
I might take a crack at a patch.
Of course there's the issue of duplicate output with $content variable. CCK has the 'exclude' checkboxes on its 'Display fields' page, not sure what could be a 'views attach' equivalent...
Comments
Comment #1
Crell CreditAttribution: Crell commentedhm. That almost sounds like it's more a CCK issue, where CCK needs to better support extra_fields-registered pseudo-fields. I'm not sure that it's a views_attach-specific issue, as the same question applies to any field you want to add to that form.
Comment #2
yched CreditAttribution: yched commentedHm. Edge case, probably. I'd advocate that it's not really cck's job to handle every node addition that ends up in $node->content :-)
I'm not sure the way CCK does the 'exclude' trick can be safely generalized to $node->content elements it did not create without messing too much with them.
Additionally, I recently found a drawback on the 'exclude' thing : the involved field escape hook_nodeapi('alter') treatment (which is supposed to act on $node->body/teaser). I'm not sure generalizing this is a good idea.
Interesting case though - in a perfect D7 world, everything (ok, most things) would be actual 'fields' and naturally gain field features. A views-attach field would be a no-storage / no widget / display-only field. Something like a computed field, only with a hardcoded 'computation'. We definitely need to make sure D7 fields can handle that.
Comment #3
Crell CreditAttribution: Crell commentedHm. A field that is nothing but a formatter. Trippy. :-)
Comment #4
OnlineWD™ CreditAttribution: OnlineWD™ commentedAm trying to theme output using suggested $node->content[view_display_id]['#value'] in node template. Have tried ..
Neither prints anything, added print 'text'; too to make sure template is being used. Please help as I want to use this method to place conditions between fields from different attachments.
Comment #5
Crell CreditAttribution: Crell at Platform.sh for Acquia commented