You are here

function theme_calendar_systems_admin_button_table in Calendar Systems 6.3

Same name and namespace in other branches
  1. 6 calendar_systems.admin.inc \theme_calendar_systems_admin_button_table()

Layout for the buttons in the Calendar systems Editor profile form.

1 theme call to theme_calendar_systems_admin_button_table()
calendar_systems_profile_form in ./calendar_systems.admin.inc
Form builder for Calendar systems profile form.

File

./calendar_systems.admin.inc, line 324
Integrate Calendar systems editors into Drupal.

Code

function theme_calendar_systems_admin_button_table(&$form) {
  $buttons = array();

  // Flatten forms array.
  foreach (element_children($form) as $name) {
    foreach (element_children($form[$name]) as $button) {
      $buttons[] = drupal_render($form[$name][$button]);
    }
  }

  // Split checkboxes into rows with 3 columns.
  $total = count($buttons);
  $rows = array();
  for ($i = 0; $i < $total; $i++) {
    $row = array();
    $row[] = array(
      'data' => $buttons[$i],
    );
    if (isset($buttons[++$i])) {
      $row[] = array(
        'data' => $buttons[$i],
      );
    }
    if (isset($buttons[++$i])) {
      $row[] = array(
        'data' => $buttons[$i],
      );
    }
    $rows[] = $row;
  }
  $output = theme('table', array(), $rows, array(
    'width' => '100%',
  ));
  return $output;
}