function js_pre_render_element in JS Callback Handler 7.2
Generic #pre_render callback.
1 string reference to 'js_pre_render_element'
- js_element_info_alter in ./
js.module - Implements hook_element_info_alter().
File
- ./
js.module, line 459 - JavaScript callback handler module.
Code
function js_pre_render_element($element) {
if (isset($element['#js_callback']) && is_array($element['#js_callback'])) {
$callback = reset($element['#js_callback']);
$module = key($element['#js_callback']);
$info = js_get_callback($module, $callback);
if (!empty($module) && !empty($callback)) {
$element['#attributes']['data-js-module'] = $module;
$element['#attributes']['data-js-callback'] = $callback;
if ($info['token']) {
$element['#attributes']['data-js-token'] = js_get_token($module, $callback);
}
}
}
return $element;
}