1

I have a view getting all fields from nodes that have a relationship with the viewed node (using delta = all); it then only shows one node using CSS styles.

How do I change the delta value for every request and take its value as an argument from the URL?

I reloaded the page from JavaScript when the user needs to see the next field (using pager controls).

Which hooks does the Views module provide to edit that value?

  • Just to make sure. The argument already exist in the url and you only need to take it and change the delta option, right? – Jack-PL Jun 27 '13 at 18:48
  • yes the pager controls links to related nodes of the viewed one I need to make the delta like a contextual filter – Mohammed Gomma Jun 27 '13 at 22:23
1

You can specify the validation criteria with PHP code in your contextual filter settings:

When the filter value IS in the URL or a default is provided

Specify validation criteria -> PHP Code

if($handler->argument){
  $view->display['default']->handler->options['pager']['options'] = array(
    'offset' => 0, 
    'items_per_page' => $handler->argument
  );
  return true;
}
else {
  return false;
}

That's it. Now, for every request the delta will be equal with the argument from the URL. $handler->argument It's the argument which has been provided by your contextual filter.

| improve this answer | |
  • where to put that piece of code – Mohammed Gomma Jun 29 '13 at 6:43
  • In your contextual filter settings. I updated my answer. – Jack-PL Jun 29 '13 at 12:03

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.