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;
}
CommentFileSizeAuthor
#4 favorite_nodes.views_.inc_.patch996 byteschriscalip
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fizk’s picture

This 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

Favorite Nodes: User ID:
[ User name ]

Please choose which context and how you would like it converted.

For AJAX, just enable "Use Ajax" under Basic Settings in the view.

kbahey’s picture

Status: Active » Needs work

Can you please create a patch, described here http://drupal.org/patch

gateway69’s picture

Hi, 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??

chriscalip’s picture

Per comment #2 generated a requested patch.

kbahey’s picture

Status: Needs work » Fixed

Thank you for the patch. It is not committed to the -dev branch. It should be in the tarball in about 10 hours from now.

Status: Fixed » Closed (fixed)

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