Hi,
I'm trying to add a custom ajax handler to an ajax enabled view without having to write my own view loader/handle custom arguments. Looks like hook_views_ajax_data_alter is what I want. There are a lot of good examples on this hook's usage for D6. You'd just add your method to a list of callbacks something like:
$object->__CALLBACKS[] = 'Drupal.behaviors.method';
However with changes to core ajax and views the hook now receives the commands array, which ties into Drupal's core ajax handling. I'm trying to figure out how to successfully add a callback to this array, but am having no luck. Have tried:
Various iterations of wiping out the array and rebuilding with no response:
$commands = array();
$commands[0]['method'] = 'Drupal.behaviors.method';
$commands[0]['command'] = 'Drupal.behaviors.method';
and also reusing the existing ajax_command_replace which generates a method not found on object '#' error. Any suggestions or good examples you could point me towards. Thanks!
Comments
Comment #1
AaronBaumanviews_load_more implements this hook.
The secret sauce in that module is that your command has to be declared like so:
Drupal.ajax.prototype.commands.myCommand
Comment #2
MustangGB CreditAttribution: MustangGB commented