function template_preprocess_ahah_response in AHAH Response 6
Preprocess variables for an AHAH response
File
- ./
ahah_response.module, line 34 - Provides a themehook to allow for greater control of the response object sent by modules implementing an AHAH callback.
Code
function template_preprocess_ahah_response(&$aVars) {
// If explicit messages and settings weren't passed in, get them.
if (!isset($aVars['messages'])) {
$aVars['messages'] = theme('status_messages');
}
if (!isset($aVars['settings'])) {
$aJavaScript = drupal_add_js(NULL, NULL);
$aVars['settings'] = isset($aJavaScript['setting']) ? call_user_func_array('array_merge_recursive', $aJavaScript['setting']) : array();
}
// Create a default response object. However, modules can implement
// preprocess functions to alter it, which is one reason we want
// to retain content, messages, and settings as independant variables.
$aVars['response'] = array(
'status' => $aVars['status'],
'data' => $aVars['messages'] . $aVars['content'] . theme('ahah_response_settings_js', $aVars['settings']),
);
}