1 ckeditor.theme.inc theme_ckeditor_settings_toolbar($variables)

Displays the toolbar configuration for CKEditor.

File

core/modules/ckeditor/ckeditor.theme.inc, line 138
Theme functions for CKEditor module.

Code

function theme_ckeditor_settings_toolbar($variables) {
  $add_group = '<span class="ckeditor-group-add-wrapper"><a href="#" class="ckeditor-group-add">' . t('Add group') . '</a></span>';

  $row_controls = '';
  $row_controls .= '<span class="ckeditor-row-controls">';
  $row_controls .= '<a href="#" class="ckeditor-row-remove" title="' . t('Remove row') . '">-</a>';
  $row_controls .= '<a href="#" class="ckeditor-row-add" title="' . t('Add row') . '">+</a>';
  $row_controls .= '</span>';

  // We don't use theme_item_list() below in case there are no buttons in the
  // active or disabled list, as theme_item_list() will not print an empty UL.
  $output = '';
  $output .= '<strong>' . t('Active toolbar') . '</strong>';
  $output .= '<div class="ckeditor-toolbar-active clearfix">';
  $output .= '<ul class="ckeditor-active-toolbar-configuration">';
  foreach ($variables['active_buttons'] as $button_row) {
    $output .= '<li class="ckeditor-row">';
    $output .= '<ul class="ckeditor-toolbar-groups">';
    foreach ($button_row as $button_group_name => $button_group) {
      $output .= '<li class="ckeditor-toolbar-group" data-group-name="' . check_plain($button_group_name) . '">';
      $output .= '<h3 class="ckeditor-toolbar-group-name">' . check_plain($button_group_name) . '</h3>';
      $output .= '<ul class="ckeditor-buttons ckeditor-toolbar-group-buttons">';
      foreach ($button_group['buttons'] as $button) {
        $contents = $button['contents'];
        $attributes = backdrop_attributes($button['attributes']);
        $output .= '<li' . $attributes . '>' . $contents . '</li>';
      }
      $output .= '</ul>';
    }
    $output .= '</ul>';
    $output .= $add_group;
    $output .= $row_controls;
    $output .= '</li>';
  }
  if (empty($variables['active_buttons'])) {
    $output .= '<li class="ckeditor-row">';
    $output .= '<ul class="ckeditor-toolbar-groups">';
    $output .= '<li class="ckeditor-toolbar-group" data-group-name="' . check_plain($button_group_name) . '">';
    $output .= '<h3 class="ckeditor-toolbar-group-name">' . check_plain($button_group_name) . '</h3>';
    $output .= '<ul class="ckeditor-buttons ckeditor-toolbar-group-buttons">';
    $output .= '</ul>';
    $output .= '</li>';
    $output .= '</ul>';
    $output .= $add_group;
    $output .= $row_controls;
    $output .= '</li>';
  }
  $output .= '</ul>';

  $output .= '</div>';

  $output .= '<strong>' . t('Available buttons') . '</strong>';
  $output .= '<div class="ckeditor-toolbar-disabled clearfix">';
  $output .= '<ul class="ckeditor-buttons">';
  foreach ($variables['disabled_buttons'] as $button) {
    $contents = $button['contents'];
    $attributes = backdrop_attributes($button['attributes']);
    $output .= '<li' . $attributes . '>' . $contents . '</li>';
  }
  $output .= '</ul>';
  $output .= '<ul class="ckeditor-multiple-buttons">';
  foreach ($variables['multiple_buttons'] as $button) {
    $contents = $button['contents'];
    $attributes = backdrop_attributes($button['attributes']);
    $output .= '<li' . $attributes . '>' . $contents . '</li>';
  }
  $output .= '</ul>';
  $output .= '</div>';

  // Wrap the whole thing in a fieldset.
  $fieldset = array(
    '#type' => 'fieldset',
    '#children' => $output,
    '#title' => t('CKEditor Toolbar'),
  );

  return backdrop_render($fieldset);
}