I have a custom media browser view display which accepts additional contextual filters relating to the node being edited (or created). I need to pass these values to the view as arguments from the node create/edit form.

Is there a recommended way to go about this?

Comments

lanzs’s picture

I was thinking how to solve it and steel can`t find a way how to get a nid of node which is on the way of creation (seems that it impossible).
I think we can only predict it, but it won`t be 100% method.
Something like this:

$type = 'product';
$nid = db_query("SELECT MAX(n.nid) as max FROM {node} n WHERE n.type = :type", array(':type' => $type))->fetch();
$new_nid = $nid->max + 1;
johnpitcairn’s picture

That won't work. What if two users are creating a node at the same time?

I don't specifically need a node nid, but I do need to pass field information. The solution I am using (for now) sets a cookie. See #1847128: Limit results to files attached to current node

chris matthews’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Closing this issue as outdated. However, if you think this issue is still important, please let us know and we will gladly re-open it for review.
sincerely,
- the Drupal Media Team