drupaldrupal-7drupal-contextual-filters

Drupal views - Use first argument to calculate second contextual filter argument


I have one contextual filter argument passed to views (Node ID).

I would like to add Global Null contextual filter (or some other contextual filter) to calculate Node Updated datetime on-the-fly using "Provide default value / PHP Code" and NID passed as first argument.

Is it possible? Is the first argument available to second one as variable which can be used for PHP calculations?


Solution

  • If you are going to use PHP code to calculate second value - you could access the first argument with the arg() function, for example, if your url would look like this: myview/arg1/arg2 - you could get arg1 value by calling arg(1).

    Actually it seems that you could simply use $_GET array to retrieve that value and use it as you like. EDIT: But only if you aren't using clean URLs (which is unlikely)