function Callbacks::checkboxCallback

Ajax callback triggered by checkbox.

File

drupal/core/modules/system/tests/modules/ajax_forms_test/lib/Drupal/ajax_forms_test/Callbacks.php, line 28
Definition of Drupal\ajax_forms_test\Callbacks.

Class

Callbacks
Simple object for testing methods as Ajax callbacks.

Namespace

Drupal\ajax_forms_test

Code

function checkboxCallback($form, $form_state) {
  $commands = array();
  $commands[] = ajax_command_html('#ajax_checkbox_value', (int) $form_state['values']['checkbox']);
  $commands[] = ajax_command_data('#ajax_checkbox_value', 'form_state_value_select', (int) $form_state['values']['checkbox']);
  return array(
    '#type' => 'ajax',
    '#commands' => $commands,
  );
}