function asaf_handle_buttons in Asaf (ajax submit for any form) 7
Same name and namespace in other branches
- 8 asaf.module \asaf_handle_buttons()
1 call to asaf_handle_buttons()
- asaf_prepare_form in ./
asaf.module - Attach ajax handlers to the specified buttons.
File
- ./
asaf.module, line 222
Code
function asaf_handle_buttons(&$element, $key, &$form_state) {
if (!empty($element['#asaf_control'])) {
$element += array(
'#type' => 'submit',
'#attributes' => array(),
'#id' => drupal_html_id(asaf_get_id($key, $form_state)),
'#ajax' => array(
'callback' => 'asaf_ajax_callback',
'path' => $form_state['asaf']['options'][ASAF_SETTINGS_PAGE_CACHE] ? 'system/ajax/asaf/pagecache' : 'system/ajax',
'wrapper' => asaf_get_area_wrapper_id(!empty($element['#asaf_target_area']) ? is_array($element['#asaf_target_area']) ? reset($element['#asaf_target_area']) : $element['#asaf_target_area'] : 'form', $form_state),
'progress' => array(
'type' => 'throbber',
'message' => '',
),
),
);
$element['#attributes'] += array(
'class' => array(),
);
$element['#attributes']['class'][] = 'asaf-control-' . $element['#asaf_control'];
$element['#attached']['js'][] = drupal_get_path('module', 'asaf') . '/js/asaf.js';
}
foreach (element_children($element) as $child_key) {
asaf_handle_buttons($element[$child_key], $key ? $key . '][' . $child_key : $child_key, $form_state);
}
}