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?

2
  • 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
    Commented Jun 27, 2013 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 Commented Jun 27, 2013 at 22:23

1 Answer 1

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.

2
  • where to put that piece of code Commented Jun 29, 2013 at 6:43
  • In your contextual filter settings. I updated my answer.
    – Jack-PL
    Commented Jun 29, 2013 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.