I have created a "Views Context" that displays fields as "Panel Fields".

I have now placed this View as a Pane in my Panels layout. (Each Row of the View has been placed as a separate Pane)

I want to use one of the Views Fields as a title for my Panels Pane.

How do I do this?

In Panels, I went to Contexts and created the following relationships: "Node from view" and "View: [View Name]". However, neither of them gave me any keywords to access the fields from the View.

I also tried using %node:title from "Node from View". However, this keyword doesn't output the node of the title from the View.

Thanks for any help!

Comments

big_smile’s picture

Issue summary: View changes

Updated message

merlinofchaos’s picture

Status: Active » Fixed

In the view itself, you can use tokens from the first row of the view in the title field. You'd then let Panels just use the VIews title of the view as the title.

big_smile’s picture

Status: Fixed » Active

Thanks for your help!

In my Panel layout, I only have one View. Each row of the View displays one Node.
Each row of the View is output as a separate Panel Pane.
I want the title of each Pane to display the title of the Node being displayed in the View Row.

When I follow your advice, each Pane has the same title (the title of the View).

How can I get each Pane to display the title of Node that is being displayed in the View row?

I thought I could use the title keyword from "Node from view". However, it doesn't work.

merlinofchaos’s picture

Ohhh. Now that one is tricky indeed. Currently there's no way to do that.

In fact, the views row pane has no title at all.

The views_row plugin would have to be modified to allow pulling the title from a field in the view, which is possible, but would require some coding. I can't think of any other way to do what you want. :(

big_smile’s picture

Thanks for your help!

My use case is this:
I am displaying related/embedded nodes on the current node page.
I want to be able to re-arrange the fields of the related/embedded nodes like you would with a regular node in Panels.

The only way I have found of doing this is by using a Views Pane.
The View Pane displays all the related/embedded nodes of the current node (using an argument).
Each Views row displays one node. (The fields of this node can be rearranged Panel-style in Views).
I then output each Views row as a separate Pane in Panels.

Is there any way to do this without Views Pane in a manner that will allow me to display a separate title for each Panel Pane?

Thanks for any help you can offer. I really appreciate it!

merlinofchaos’s picture

Maybe the 'node from view' relationship should actually be able to get you that. Are you sure you were using the correct keyword? If there's more than one node, then %node will only be the keyword for the very first node relationship (or other context).

big_smile’s picture

Yes, I have double checked the key word.

This is how I have it set up:

In Panels, under Contexts, I have the View Selected.
Then under "Relationships" I have node from View. In the relationships box, my View is listed under View (it is the only option in the drop down box).
Row number is set to 1.

When I apply the keyword for this relationship to the Pane, nothing is displayed.

When I do this, however, I get the following error message;

Notice: Undefined property: stdClass::$nid in views_content_node_from_view_context() (line 37 of /<sitename>/lololabs/sites/all/modules/ctools/views_content/plugins/relationships/node_from_view.inc).
Notice: Undefined property: stdClass::$nid in views_content_node_from_view_context() (line 37 of /<sitename>/lololabs/sites/all/modules/ctools/views_content/plugins/relationships/node_from_view.inc).

Could the error message be stopping it from working?

Many thanks for any help you can provide!

merlinofchaos’s picture

You may need to add the nid field to your view -- that error does look like the relationship is actually failing. With Views 3, there's no requirement for the nid to appear as a field, so the relationship would be unable to use it if it can't find that.

big_smile’s picture

Thanks for your continued help!

When I add an NID to the view, the error message disappears.

However, when I use the keyword for title, it only displays the title of the main node instead of the title of the related/embedded node.

In my set up, each node has a related/embedded node that is established with an entity reference field.
The View uses a Relationship that calls the entity reference field.
Every field in the View uses the relationship.

The contextual filter doesn't use the relationship.

Is that the correct way of setting it up? Is there anything in my set up that could prevent the title from appearing.

I have tried experimenting with the View with different configurations. However, it seems the Fields need to use a Relationship and the Contextual Filter must not have a relationship, otherwise the View cannot display the related/embedded nodes.

Thanks for any help you can offer!

merlinofchaos’s picture

Unfortunately the relationship can only use the main node at this time. Can you rewrite the view so that the relationship is reversed? It's often possible to do this, just be switching which relationship the filters are on and reversing the direction of the relationship.

big_smile’s picture

At the moment the Relationship on the View is "Entity Reference: Referenced Entity".
I have removed this and replaced it with "Entity Reference: Referencing entity" (which is the reverse).

However, when I do this, no nodes appear in the View.

I have tried both making sure the fields use the new relationship, the old relationship (before I removed it) and no relationship, but no nodes will appear.

big_smile’s picture

Issue summary: View changes

Update