You are here

function bueditor_admin_theme in BUEditor 7

Same name and namespace in other branches
  1. 6.2 admin/bueditor.admin.inc \bueditor_admin_theme()
  2. 6 bueditor.admin.inc \bueditor_admin_theme()

Admin form theming.

1 string reference to 'bueditor_admin_theme'
bueditor_theme in ./bueditor.module
Implements hook_theme().

File

admin/bueditor.admin.inc, line 83

Code

function bueditor_admin_theme($variables) {
  $form = $variables['form'];
  $header = array(
    t('User role'),
    t('Assigned editor'),
    t('Alternative editor'),
  );
  $keys = array(
    'name',
    'editor',
    'alt',
  );
  $info = '';
  if ($form['#weighted']) {
    $header[] = t('Weight');
    $keys[] = 'weight';
    $info = '<br />' . t('For users who have <strong>multiple roles</strong>, the <strong>weight</strong> property will determine the assigned editor. Lighter roles that are placed upper will take the precedence. So, an administrator role should be placed over other roles by having a smaller weight, ie. -10.');
  }
  $rows = array();
  foreach (element_children($form['roles']) as $rid) {
    $cells = array();
    foreach ($keys as $key) {
      $cells[] = drupal_render($form['roles'][$rid][$key]);
    }
    $rows[] = $cells;
  }
  $output = '<h2 class="title">' . t('Role-editor assignments') . '</h2>';
  $output .= theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'roles-editors-list',
    ),
  ));
  $output .= '<div class="form-item"><div class="description">' . t('Assign editors to user roles.') . '<br />' . t('Alternative editor makes it possible to use different editors for different textareas or different editors on diffrent pages. You just have to configure visibility settings for each editor.') . $info . '</div></div>';
  $output .= drupal_render_children($form);
  return $output;
}