1 views.api.php hook_views_ajax_data_alter(&$commands, $view)

This hook allows to alter the commands which are used on a views ajax request.


$commands: An array of ajax commands

$view view: The view which is requested.

Related topics


core/modules/views/views.api.php, line 948
Describe hooks provided by the Views module.


function hook_views_ajax_data_alter(&$commands, $view) {
  // Replace Views' method for scrolling to the top of the element with your
  // custom scrolling method.
  foreach ($commands as &$command) {
    if ($command['command'] == 'viewsScrollTop') {
      $command['command'] .= 'myScrollTop';