function ajax_load_ajax_data_alter in Ajax Load 6.2
Implementation of hook_ajax_data_alter().
File
- ./
ajax_load.module, line 26 - Enable loading of Javascript and CSS data with AJAX loads.
Code
function ajax_load_ajax_data_alter(&$data) {
//$extra = ajax_data_get_data();
$array = FALSE;
// Detect whether the data being altered is an array.
if (is_array($data)) {
$data = (object) $data;
$array = TRUE;
}
// use ctools system for preping the shutdown handler on an ajax call
ini_set('display_errors', 0);
register_shutdown_function('ctools_shutdown_handler');
//$data->scripts = $extra['scripts'];
//$data->css = $extra['css'];
if (!isset($data->__callbacks)) {
$data->__callbacks = array();
}
if (!isset($data->__commands)) {
$data->__commands = array();
}
// Set the AjaxLoad custom event as a callback.
$data->__callbacks[] = 'Drupal.CTools.AJAX.commands.ajax_load';
// use ctools js and css construction
// also, allow __commands to be used to store ctools ajax commands in ajax_load callbacks
$data->__commands = ajax_load_ajax_render($data->__commands, FALSE);
// Cast back to an array if necessary.
if ($array) {
$data = (array) $data;
}
}