1

I have two content types, Ad and Reply (think of how posting works on Craigslist for the Ad, and the Reply is an on-site form to reply). I am using Entity Reference Prepopulate to automatically create an entity reference back to the Ad when users click a link to make a Reply. The link looks like this:

node/add/reply?field_reply_orig_node=NID

Where NID is the node ID (filled in with a token using Panels).

Using Panels, I'd like to display the original Ad on the Reply edit page (to make it easier for users to write their message. I have overriden the node edit page (using Page Manager) and I added a view that has a contextual filter (NID). However, I don't understand how to pass a value for NID to the content pane using the reply link.

Ideally, I could make use of the ?field_reply_orig_node=NID that is already present in the link (how?), but if that is not possible, I could rewrite the link in Panels. I just don't understand how to rewrite it so that the contextual filter can pick up the value.

1

One solution would be to add a custom panel to a panel page overriding the node edit form.

To do so you'll want to go into Panels Page Manager (/admin/structure/pages) and enable node_edit adding a variant that uses context to evaluate Node: type where Node being viewed is type "Your Content Type"

Then go into the panel page content section and choose "New Custom Content" from the panel selection dialog.

In the dialog that opens, makes sure to choose and input format that allows hyperlinks.

Make sure "Use context keywords" is checked and in the substitution choices you'll see %node:nid

You can use this to build the url:

<a href="/node/add/reply?field_reply_orig_node=%node:nid" title="Add Reply>Reply</a>

Panels add New Custom Content Dialog

  • Looking at this again, you may be able to accomplish this more simply by choosing Entity reference > Content prepopulate links in the Panels Add Content pop-up dialog and checking the Reply content type. In the context of a node edit form override this should be available and saves quite a few steps! – Brent Nov 11 '13 at 17:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.