You are here

function theme_wysiwyg_admin_button_table in Wysiwyg 7.2

Same name and namespace in other branches
  1. 5.2 wysiwyg.admin.inc \theme_wysiwyg_admin_button_table()
  2. 5 wysiwyg.admin.inc \theme_wysiwyg_admin_button_table()
  3. 6.2 wysiwyg.admin.inc \theme_wysiwyg_admin_button_table()
  4. 6 wysiwyg.admin.inc \theme_wysiwyg_admin_button_table()

Layout for the buttons in the Wysiwyg Editor profile form.

1 theme call to theme_wysiwyg_admin_button_table()
wysiwyg_profile_form in ./wysiwyg.admin.inc
Form builder for Wysiwyg profile form.

File

./wysiwyg.admin.inc, line 491
Integrate Wysiwyg editors into Drupal.

Code

function theme_wysiwyg_admin_button_table($variables) {
  $form = $variables['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 += 3) {
    $row = array();
    $row_buttons = array_slice($buttons, $i, 3) + array_fill(0, 3, array());
    foreach ($row_buttons as $row_button) {
      $row[] = array(
        'data' => $row_button,
      );
    }
    $rows[] = $row;
  }
  $output = theme('table', array(
    'rows' => $rows,
    'attributes' => array(
      'width' => '100%',
    ),
  ));
  return $output;
}