Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Add this to the end of favorite_nodes_views_data()
function favorite_nodes_views_data() {
...
...
// Relationship to the 'Node' table
$data['favorite_nodes']['nid'] = array(
'title' => t('Node'),
'help' => t('The node that was favorited.'),
'relationship' => array(
'label' => t('Node'),
'base' => 'node',
'base field' => 'nid',
'type' => 'inner',
// This allows us to not show this relationship if the base is already
// comments so users won't create circular relationships.
'skip base' => array('node'),
),
);
return $data;
}
Comment | File | Size | Author |
---|---|---|---|
#4 | favorite_nodes.views_.inc_.patch | 996 bytes | chriscalip |
Comments
Comment #1
fizk CreditAttribution: fizk commentedThis allows me to create my own view that displays a user's favorite nodes.
1. Relationships => Favorite Nodes => "Favorite Nodes: Node"
2. Arguments => Favorite Nodes => "Favorite Nodes: User ID"
3. Fields => Node => "Node: Title" and "Node: Type"
Fields => "(Node) Node: Type" => Label should be blank, and click "Exclude from display"
Fields => "(Node) Node: Title" => Label should be blank
4. Basic Settings => Style => HTML List => Grouping field => Node: Type
For the profile page, I'm using Advanced Profile Kit, so I created a "Content Page" in my view which is visible under "Views" when configuring the User Profile Panel.
Here's the catch for me: make sure you set the User ID to User name
For AJAX, just enable "Use Ajax" under Basic Settings in the view.
Comment #2
kbahey CreditAttribution: kbahey commentedCan you please create a patch, described here http://drupal.org/patch
Comment #3
gateway69 CreditAttribution: gateway69 commentedHi, i added the code above to the module, but when creating a new view, I do not see under relationships the favorites node to select??
Comment #4
chriscalip CreditAttribution: chriscalip commentedPer comment #2 generated a requested patch.
Comment #5
kbahey CreditAttribution: kbahey commentedThank you for the patch. It is not committed to the -dev branch. It should be in the tarball in about 10 hours from now.