You are here

function theme_bueditor_form_editor in BUEditor 5

Editor form themed.

File

./bueditor.module, line 208

Code

function theme_bueditor_form_editor($form) {
  $eid = $form['editor']['eid']['#value'];
  $header = array(
    array(
      'data' => t('Title'),
      'class' => 'title',
    ),
    array(
      'data' => t('Content'),
      'class' => 'content',
    ),
    array(
      'data' => t('Icon'),
      'class' => 'icon',
    ),
    array(
      'data' => t('Key'),
      'class' => 'key',
    ),
    array(
      'data' => t('Weight'),
      'class' => 'weight',
    ),
    array(
      'data' => ' ',
      'class' => 'check',
    ),
  );
  $rows = array();
  foreach ($form['button'] as $bid => $button) {
    $new = substr($bid, 0, 3) == 'new';
    if (is_array($button['title'])) {
      $cells = array();
      $cells[] = drupal_render($form['button'][$bid]['title']);
      $cells[] = drupal_render($form['button'][$bid]['content']);
      $cells[] = drupal_render($form['button'][$bid]['icon']) . drupal_render($form['button'][$bid]['caption']);
      $cells[] = drupal_render($form['button'][$bid]['accesskey']);
      $cells[] = drupal_render($form['button'][$bid]['weight']);
      $cells[] = $new ? '<a>' . t('new') . '</a>' : drupal_render($form['checks'][$bid]);
      $rows[] = $new ? array(
        'data' => $cells,
        'class' => 'new-button',
        'title' => t('Add new button'),
      ) : $cells;
    }
  }
  $table = theme('table', $header, $rows, array(
    'class' => 'button-table',
    'id' => 'button-table',
  ));
  $vis = theme('fieldset', array(
    '#title' => t('Visibility settings'),
    '#children' => drupal_render($form['editor']['pages']) . drupal_render($form['editor']['excludes']),
    '#collapsible' => TRUE,
    '#collapsed' => $eid != 'new',
  ));
  $selaction = '<div class="sel-action">' . drupal_render($form['selaction']) . drupal_render($form['go']) . '</div>';
  $output = drupal_render($form['editor']['name']) . ($eid == 'new' ? $vis : '');
  $output .= '<h2 class="title">' . t('Buttons') . '</h2>' . $table . $selaction;
  $output .= drupal_render($form['submit']) . ($eid == 'new' ? '' : $vis);
  $output .= theme('fieldset', array(
    '#title' => t('Import Buttons'),
    '#children' => drupal_render($form['buecsv']) . drupal_render($form['import']),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  ));
  $output .= drupal_render($form);
  return $output;
}