Download & Extend

expose variables in node / users templates

Project:Views attach
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:postponed

Issue Summary

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

#1

hm. 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.

#2

Hm. 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.

#3

Status:active» postponed

Hm. A field that is nothing but a formatter. Trippy. :-)

#4

Am trying to theme output using suggested $node->content[view_display_id]['#value'] in node template. Have tried ..

<?php
print $node->content['nothing_1']['#value'];
print
$node->content[nothing_1]['#value'];
?>

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.

nobody click here