node load arguments
stellrex - July 11, 2009 - 00:45
How do I create an argument to load a node revision?
For example that path node/15/revisions/17/view
How do I create an argument to load a node revision?
For example that path node/15/revisions/17/view
In what context do you want to create an argument?
Maybe this can help you: http://drupal.org/node/224170
I'm trying to create a
I'm trying to create a contextual view, using the views module that will load data from a node in revision instead of just the current published revision, so that moderators can view field updates from within the related node
For example, there's a node:
node/15
that contains field_sidebar_1
and a view block. When user is looking at node/15, it shows field_sidebar_1's contents in the view block. however, let's say node/15 gets edited and revision is created which then is pending moderation... so now you have a node/15/revision/16 . I'm trying to get it so that when the moderator looks at node/15/revision/16, it shows the updated field in the view block
I know this seems like a small thing, but the users are making such a big deal of it and I can't figure it out. I've been searching for the solution all week
What do you get when you are
What do you get when you are using path 'node/15/revision/16/view'? That should show you the value of the pending revision.
____________________
You have to find out if your view block is using the $node object of the current path.
Let me try to explain: If you call a drupal path (e.g. 'node/15') then drupal will look for a matching menu item. In this example it will find 'node/%node' (defined in http://api.drupal.org/api/function/node_menu/6). My link above explaines what the '%node' means: call node_load() function with the given 2nd path argument ('15' in our example). Then the loaded node object will be passed to page callback (e.g. ... 'page callback' => 'node_page_view', 'page arguments' => array(1), ... for 'node/%node' path).
WorldFallz' link describes how node_load function is working:
node_load($param = array(), $revision = NULL, $reset = NULL)
So you have to make sure that the 2nd parameter of node_load() function (the version ID, in your example vid=16) will be passed to the node_load call the view block is using.
Using a drupal path like 'node/15/revision/16/view' leads to $node object as result of a call node_load(15, 16) which should contain your wanted pending version.
This node object will be passed to page callback (again defined in http://api.drupal.org/api/function/node_menu/6) for menu item 'node/%node/revisions/%/view': ... 'page callback' => 'node_show', 'page arguments' => array(1, NULL, TRUE), ...
and everything should be fine, isn't it?
If not, then your problem is within your view block (which is not using the path's $node object). Try to find out how you can tell your view block to use your path's version ID parameter (4th path argument) for paths like 'node/%node/revisions/%/view'.
Good luck.
_
see http://api.drupal.org/api/function/node_load/6
_
Don't be a Help Vampire - read and abide the forum guidelines.
If you find my assistance useful, please pay it forward to your fellow drupalers.
_
Also please don't post duplicate threads-- I deleted the other one since it didn't have any responses, thanks.
_
Don't be a Help Vampire - read and abide the forum guidelines.
If you find my assistance useful, please pay it forward to your fellow drupalers.