You are here

function asaf_mark_buttons in Asaf (ajax submit for any form) 8

Same name and namespace in other branches
  1. 7 asaf.module \asaf_mark_buttons()
1 call to asaf_mark_buttons()
asaf_prepare_form in ./asaf.module
Attach ajax handlers to the specified buttons.

File

./asaf.module, line 214
Main module file.

Code

function asaf_mark_buttons(&$element, $key, &$form_state) {
  $buttons = $form_state['asaf']['buttons'];
  if (!isset($element['#asaf_control']) && isset($element['#type']) && $element['#type'] == 'submit' && asaf_is_handled_button($key, $buttons)) {
    $element['#asaf_control'] = 'asaf_submit';
    $element += asaf_get_handled_button_options($key, $buttons);
  }
  foreach (element_children($element) as $child_key) {
    asaf_mark_buttons($element[$child_key], $key ? $key . '][' . $child_key : $child_key, $form_state);
  }
}