Most use cases for 'node content' involve : build some stuff involving the current node id (get all the nodes that reference this node, etc...)

What I did so far, and what I see you advised in support issues here, is basically on 'use an argument, and set it as 'nid from URL' as default arg value.

But this won't on other pages than the node's own page - meaning, setting this 'node content' to display on teasers is useless.

Maybe we need an additional 'default argument' handler : 'Nid of the node we are attached to', instead of using "Nid from URL' ? Annoying thing is that I'm not sure there's a way to restrict a default arg handler to a given dsplay plugin

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Crell’s picture

Hm. That's similar to a use case I have on Views/OG integration, where I want to say "filter by the current OG context". Hm.

I definitely see the problem there, as then this doesn't work on teasers even though you can flag teasers for use. We may have to bring merlin in on this one.

Crell’s picture

So, just discussed this with merlin in IRC. Two possibilities:

1) Add a checkbox to the display settings to have the nodeapi implementation pass the nid (and maybe the vid as another option?) into the views_embed_view() call as an argument. Then the default handling is ignored and you get whatever the attached view is for whatever its render mode is. Done.

2) Allow arguments to be specified via token module, so we can pass in any token-accessible field of a node as an argument.

I like the simplicity of #1, which will probably still cover 90% or better of use cases.

Who wants to write the patch? :-) (Not sure about vid. I've never even tried making node revision views...)

yched’s picture

Agreed that #1 should be more than enough.
I can probably try to write that one.

yched’s picture

Status: Active » Needs review
FileSize
5.05 KB

Patch attached.
This only implements 'nid' and 'uid' as defauly arguments. The internal option values are 'nid' / 'uid', so that it can later be expanded without too much BC issues.

George2’s picture

i made a view for my content profile content type, i tried the node content display, and profile view, and neither worked on the profile users/foo. after applying this patch, both worked as expected and appeared on the profile, so i'm happy :)

in the case of content_profile, it's better to use the node content display as it's actually a node type rather than the profile display.

thanks yched

George2’s picture

Status: Needs review » Reviewed & tested by the community
Crell’s picture

Status: Reviewed & tested by the community » Fixed

Committed to dev. Thanks guys!

yched’s picture

Thx Larry. The 'usage tips' on the project page ('Set the default value of that argument to "Node ID from URL".') could probably updated to reflect the new behavior.

Crell’s picture

Yep. George2 already said the project page docs were confusing. Let's open a separate issue for that. ;-)

yched’s picture

There was a little clash between the commits of this patch and #362250: use content_build_modes() for finer control.
There is now a missing break; in views_attach_plugin_display_node_content::options_submit() that causes the 'default argument' to come back to 'None' when you submit the 'Build modes' setting.

Boldly setting to RTBC.

yched’s picture

Status: Fixed » Reviewed & tested by the community

"Boldly setting to RTBC", he said.

Crell’s picture

Status: Reviewed & tested by the community » Fixed

Fixed as part of another issue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.