I don't know if this is a Relation issue or not but I have to start somewhere.

After updating to Drupal 7.22 a small portion of my site stopped functioning.

What I have set up is a Viewfield that takes an argument provided by the token [node:relation-is-the-playlist-for-node:0] and feeds it into a View. The view then takes this argument and uses a Contextual Filter to display content based on the token value.

"is the playlist for" is a directional relationship that is used to link the content type "Video Series" to the content type "Videos". Each Video Series can have multiple Videos associated with it.

This was working perfectly until updating to Drupal 7.22. Now the Viewfield is empty, as if the token is not providing any information to the Contextual Filter. At one time I knew how to test what value was being sent by the token but I have since forgotten how to do that so I don't know if the token is providing anything or not.

The relationship is still working because I have another area of the site that uses the relationship to show the Videos associated with the Video Series but it does not rely on the [node:relation-is-the-playlist-for-node:0] token.

I have tried using other tokens such as [node:relation-is-the-playlist-for-node], [node:relation-is-the-playlist-for-node:1], [node:relation-is-the-playlist-for-node:2], and [node:relation-is-the-playlist-for-node:3] but I still get no results in the Viewfield.

Any suggestions how I can approach finding where the problem lies and how to correct it?

Comments

naught101’s picture

Status: Active » Postponed (maintainer needs more info)

Did you only upgrade drupal core, or did you upgrade other modules as well (in particular views)? I can't see why this would break. Have you tried re-creating the view from scratch?

wimberb’s picture

Hello naught101. Thank you for your response. At the time that I noticed the Viewfield had stopped working I had only updated Drupal to 7.22 from 7.21. However, it is possible that it had stopped working prior to this time and I just didn't notice it. Since that time I have updated Views to the latest release and have also updated various other modules.

From what I can tell it appears that the token is not being sent to Views. I have tried creating Video Listings using both Viewfield and EVA. Even though the view works correctly when entering a value in the contextual filter preview it does not work on an actual node. If I delete the contextual filter I get a list of ALL videos. But if I have the contextual filter to limit the types of videos to display I get nothing on the node.

I have tried using Devel to determine what token values are being sent to the node but I keep getting a timeout error before the tokens are displayed. So at this point I can't even determine if Relation tokens are being sent to the View and if so what those values are.

naught101’s picture

Title: [node:relation-is-the-playlist-for-node:0] » Relation tokens not accessible from Viewfield.
Category: support » bug

Sounds bad. Just to confirm, did you try re-creating the view from scratch? Also, did you upgrade relation? I will try on my machine, and see if I can replicate the problem.

wimberb’s picture

Naught101, I tried recreating the view as you suggested and I'm still getting nothing. The view works perfectly when entering a value in the view preview but I get nothing when attaching the view to a node using either EVA or Viewfield. If I delete the contextual filter I do get a complete listing of all videos in both EVA and Viewfield but a contextual filter that relies on a token from Relation produces nothing.

I am running Drupal 7.22, Views 7.x-3.7, EVA 7.x-1.2+4-dev (2012-Nov-05), Viewfield 7.x-2.0, and Relation 7.x-1.0-rc4+14-dev (2013-May-05).

As stated earlier, this view was working perfectly and then one day shortly after upgrading to Drupal 7.22 I noticed that the views were no longer working.

Just to clarify, EVA and Viewfield provide a means of attaching a View to a node but they each take a different approach. EVA is created within a View. A Viewfield is added to a content type as if it were a field. Both methods accept tokens to be fed into a contextual filter for a view. And it is this token that appears to be the problem. The specific token I am using is [node:relation-is-the-playlist-for-node:0].

The Relation is:

$relation_type = new stdClass();
$relation_type->disabled = FALSE; /* Edit this to true to make a default relation_type disabled initially */
$relation_type->api_version = 1;
$relation_type->relation_type = 'is_the_playlist_for';
$relation_type->label = 'is the playlist for';
$relation_type->reverse_label = 'is in the playlist';
$relation_type->directional = 1;
$relation_type->transitive = 0;
$relation_type->r_unique = 0;
$relation_type->min_arity = 2;
$relation_type->max_arity = 2;
$relation_type->source_bundles = array(
  0 => 'node:video_series',
);
$relation_type->target_bundles = array(
  0 => 'node:videos',
);
naught101’s picture

Sorry, I'm having a hard time reproducing what you're doing. Are you putting the viewfield on the videos, or the view series nodes? Is the view a relation view, or a content view? Do the tokens you're trying to use actually appear in the replacements list below the argument field in the viewfield edit page? Why can't you just use the [node:nid] token, with appropriate views relationships? I'm not familiar with EVA: how does it relate to viewfield?

Re: the upgrade, which version of drupal (and relevant modules) did you upgrade from?

wimberb’s picture

The Viewfield goes on the Video. In each Video I use a Relation Field to create a relation back to the Video Series the Video belongs to.

Video Series 1 ---> Video 1
|--> Video 2
|--> Video 3

Video Series 2 ---> Video 4
|--> Video 5
|--> Video 6

The View is a Content view

The token I am using does appear in the list of available tokens. I appended :0 to the token to make it reference just the first endpoint but I also tried it without the :0 and with :1, :2, and :3.

I have tried using [node:nid] but still get no results.

The only reason I tried EVA is because I have another module that requires it. But I didn't install EVA until after this problem started so EVA is not the cause of the problem. EVA differs from Viewfield in that the EVA view is defined within the View whereas the Viewfield is defined in the content type fields. In the View you select +Add as if you were defining a new Page or Block. But instead of Page of Block you select EVA Field. You define the EVA Field just like any other page within Views. In the definition you can attach the EVA to an entity type by selecting it from the list. I selected Vides content type and token as the argument. After attaching the EVA to Videos the EVA appears as a Field in the Videos content type.

I had previously described the method I used here: http://drupal.org/node/1304196#comment-6494398

naught101’s picture

Status: Postponed (maintainer needs more info) » Fixed

I have tried using [node:nid] but still get no results.

This definitely works, if you use the validation correctly. I've done fairly similar things on http://scorecard.org.au/scorecard/electorate/newcastle (the two tables are both viewfields with [node:nid] as the contextual filter, with relations from the electorate (newcastle) to the candidates, and their parties, and survey responses. Don't really see why EVA would be much different. Create a view with just the node title (the title of the node who's ID you're passing) and no other relationships or fields, to make sure your contextual filter is working properly first. If your view is working in the preview, it sounds like that's your problem, and then it's not really anything to do with relation.

Status: Fixed » Closed (fixed)

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