Download & Extend

One method of views support

Project:Associated Nodes
Version:6.x-1.5
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review

Issue Summary

Can we construct views to replace the block supplied in Associated Links?

Comments

#1

This module sounds awesome. I'm currently comparing automatic node relationship tools like this one. I like the idea that this module can compare both taxonomy and cck field values.

I would love to know what the views integration capabilities of this module are, or what kind of integration you might have planned for the future.

The reason this is critical is that the node relationship might be only one factor that goes into filtering items.

I think that a module like this should provide both a filter/argument handler and a sort handler. If someone were to use the sort handler without the filter then the filters set on the view might only let a couple of items which have a relationship through. The sort filter would allow those couple items to be promoted to the top of the list.

#2

Presently, there is no special interface with views. The only module part of the project that display associated nodes is "Associated Links" that just provides a block with links to associated nodes for a given node. But you can develop your own module using the Associated Nodes' API, especially the associated_nodes_get function.
Since your are not the first to ask about a Views integration, I think this will be a new feature in a next release.

#3

Super! I'll be happy to help test. :)

#4

I would like to use views just to have a more flexible way of displaying the associated nodes, for example - with their thumbnails.
so subscribing.

#5

Yep, I need a way to get a list of nodes displayed with their
thumbnails and post date, so Views integration would make
this module perfect! :]

Szy.

#6

I would be interested in sponsoring views support.

David

#7

Title:Views support?» One method of views support

So to use this in views.

Create a Argument for Nid and select 'Provide default argument -> PHP Code'

and use the following code

<?php
$node_nid
= arg(1);

$associated_nodes = associated_nodes_get($node_nid,{insert association id here});

$nodes = array();
foreach (
$associated_nodes as $nid => $weight) {
 
$nodes[] = $nid;
}
return
implode(",", $nodes);
?>

You need to know the ID of the association you want to use you can then filter and sort with the usual views features

David

#8

subscribing.

#9

Category:support request» feature request
Status:active» needs review

This patch introduces native views support.

Briefly, here is how it works:

- Create a view
- Add an Argument of type 'Associated Nodes: Originating Nid' (you can select the associationID you want to use, or leave empty for all associations)
- Add a relationship of type 'Associated Nodes: Associated Nid'
- Add (Node) fields and use the Relation you just created.

There are also a few fields of the Associated Nodes module that you can use to filter & sort (like score) These do not require a relationship.

I made some small changes to the caching mechanism, I think it can be optimized some more, still. So far, this will work.

AttachmentSize
views_support-603096-9.patch 8.21 KB

#10

Thanks

This patch is great, but has one minor problem. This line

+      if (associated_node_add_to_cache($node, $aid) > 0) {

should be

+      if (associated_nodes_add_to_cache($node, $aid) > 0) {

#11

I am now seeing another problem.

When editing the association originating node I'd argument the association I'd is stuck on 1 and changes aren't saved.

It would be good to look at how this could be a drop down to select the association.

#12

Thanks for your interest in this module.
Unfortunately, I don't have time to maintain it for the moment... Sorry for that.

nobody click here