How to set context by url argument for node preprocess I have a View of nodes, rendered using a Display Suite view mode.  I need for users to either view the page with or without an argument in the path.  If they don't enter an argument, I want the nodes in the View to render normally, but if they do, like someview/10, I simply want to add a CSS class for that node in preprocess.  I have the Context module installed, so I'd like to be able to use that, but it doesn't seem like I can specify path arguments that I maybe set a context for that I can check for in the node preprocess.  Or if I can do it in Views somehow, that would be great, but I can't seem to figure that out.

This functionality is for a nojs user.  For js users, I just send the ajax commands back and set the CSS, but for nojs, I need to route them (I guess with drupal_goto())  to the View with the nid as an argument.
Here's a sketch of what you could do, using a custom module:


Define a menu entry for someview/%node.
Define a callback function for the menu entry with a node argument.
Store the node ID for later use. This could be done using drupal_static or the context API.
In your preprocess function, retrieve the node ID and add a CSS class if required.


You could also use Panels to achieve a similar end, I think, but this is a fairly lightweight, if specific solution.

Let me know if you need a fuller explanation. I realise not everyone is familiar with Drupal APIs.

So your menu callback might look like:
function mymodule_callback($node) {
 context_set("mymodule", "active_nid", $node-&gt;nid);
 return views_embed_view((... ...);
}


and in the preprocess:

$active_nid= context_get("mymodule", "active_nid");
 if($active_nid==$node-&gt;nid) {
 ...
}