function _form_test_tableselect_colspan_form

Test the tableselect #colspan functionality.

1 string reference to '_form_test_tableselect_colspan_form'
form_test_menu in drupal/core/modules/system/tests/modules/form_test/form_test.module
Implements hook_menu().

File

drupal/core/modules/system/tests/modules/form_test/form_test.module, line 782
Helper module for the form API tests.

Code

function _form_test_tableselect_colspan_form($form, $form_state) {
  list($header, $options) = _form_test_tableselect_get_data();

  // Change the data so that the third column has colspan=2.
  $header['three'] = array(
    'data' => 'Three',
    'colspan' => 2,
  );
  unset($header['four']);

  // Set the each row so that column 3 is an array.
  foreach ($options as $name => $row) {
    $options[$name]['three'] = array(
      $row['three'],
      $row['four'],
    );
    unset($options[$name]['four']);
  }

  // Combine cells in row 3.
  $options['row3']['one'] = array(
    'data' => $options['row3']['one'],
    'colspan' => 2,
  );
  unset($options['row3']['two']);
  $options['row3']['three'] = array(
    'data' => $options['row3']['three'][0],
    'colspan' => 2,
  );
  unset($options['row3']['four']);
  return _form_test_tableselect_form_builder($form, $form_state, array(
    '#header' => $header,
    '#options' => $options,
  ));
}