attached_node.module - feature request
| Project: | Attached Node |
| Version: | 4.5.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | javanaut |
| Status: | active |
Jump to:
I got all breathy and excited by the possibilities of the attached_node.module when I saw it listed.
But ultimately was disappointed. I originally posted a call for such a thing:
But the attached_node doesn't quite do what I was hoping. I'd like to use the syntax as sepcified, and have it NOT force an embedded "node" DIV element - ONLY have the content itself embedded in the new node. In this case, I want the WHOLE node content embedded, not just a teaser. It would be nice if I could specify options like
use node DIV
attach full text
attach teaser only
as a switch passed through the attached_node module, so it "does the right thing".
Thank you for a great start on this module. I may end up hacking it up to do what I want, in which case, I'll be happy to contribute my changes back to it.

#1
For clarity about what I was considering, it might look something like this:
[node:NID:OPTION:VARS]
which might translate to something like:
[node:20:full]
or
[node:20:teaser]
or
[node:20::res=640x480]
I know the challenge is going to be with the "full" option - since I started looking into it - it appears that the rendering of a node is extremely tightly coupled with the whole "node" theming system. It might take a custom SQL query to make the "fulL" option viable and work...
#2
Thanks for the feature request. I think you can do this by overriding the theme function theme_attached_node_thumbnail(&$node) on a one-off basis. It wouldn't be too difficult to add another "special" parameter that would be used to say which property to display (if not the default node_view output).
It'll require some testing, but I would implement this as such:
1. Enable a parameter for the target node type (call it 'attachment_property' or something else unique)
2. Add the following code to the top of theme_attached_node_thumbnail(&$node)
<?phpif($node->attachment_property) {
$prop = $node->attachment_property;
if(isset($node->$prop)) {
return $node->$prop;
// or, to theme it,
//theme("attached_node_format",$node->$prop);
}
}
?>
3. Include node content for just a particular property ($node->teaser in this case):
[node:123,attachment_property="teaser"]
If you try this out and/or it is actually what you're asking for, let me know (I haven't tried this yet). I should be updating this code some soon, btw.
#3
Smashing! This did work! I've been eye-balling this update to attached node, hoping that I could do this, and I am happy to tell you this works.
The only thing I still need to do: have attached module include the image in the attached, non-teaser version of the attached module. For some reason, even though I'm not looking at a teaser anymore, the image has been dropped... maybe this is something that is covered elsewhere; I'll check the readme and the module for possible solutions.
Great and simple update to attached node! Thanks.