function hook_views_ajax_data_alter

Allows altering the commands which are used on a views AJAX request.

Parameters

array $commands: An array of ajax commands.

object $view: The view which is requested.

Related topics

1 invocation of hook_views_ajax_data_alter()
views_ajax in includes/ajax.inc
Menu callback to load a view via AJAX.

File

./views.api.php, line 1290

Code

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';
        }
    }
    unset($command);
}