function _asaf_get_form_details_from_stacktrace in Asaf (ajax submit for any form) 7
Same name and namespace in other branches
- 8 asaf.module \_asaf_get_form_details_from_stacktrace()
2 calls to _asaf_get_form_details_from_stacktrace()
File
- ./
asaf.module, line 623
Code
function _asaf_get_form_details_from_stacktrace() {
static $form;
static $form_state;
if (!$form || !$form_state) {
$stacktrace = debug_backtrace();
foreach ($stacktrace as $step) {
$args = isset($step['args']) ? $step['args'] : FALSE;
if (is_array($args)) {
foreach ($args as $arg) {
if (!$form && is_array($arg) && isset($arg['#type']) && $arg['#type'] == 'form') {
$form = $arg;
}
if (!$form_state && is_array($arg) && isset($arg['build_info']) && is_array($arg['build_info'])) {
$form_state = $arg;
}
}
if ($form && $form_state) {
break;
}
}
}
}
return array(
$form,
$form_state,
);
}