function template_preprocess_ckeditor_settings_toolbar

Preprocess variables for theme_ckeditor_settings_toolbar().

File

drupal/core/modules/ckeditor/ckeditor.admin.inc, line 14
Callbacks and theming for the CKEditor toolbar configuration UI.

Code

function template_preprocess_ckeditor_settings_toolbar(&$variables) {

  // Simplify the language direction information for toolbar buttons.
  $language_interface = language(Language::TYPE_INTERFACE);
  $variables['language_direction'] = $language_interface->direction ? 'rtl' : 'ltr';

  // Create lists of active and disabled buttons.
  $editor = $variables['editor'];
  $plugins = $variables['plugins'];
  $buttons = array();
  $variables['multiple_buttons'] = array();
  foreach ($plugins as $plugin => $plugin_buttons) {
    foreach ($plugin_buttons as $button_name => $button) {
      $button['name'] = $button_name;
      if (!empty($button['multiple'])) {
        $variables['multiple_buttons'][$button_name] = $button;
      }
      $buttons[$button_name] = $button;
    }
  }
  $variables['active_buttons'] = array();
  foreach ($editor->settings['toolbar']['buttons'] as $row_number => $row) {
    foreach ($row as $button_name) {
      if (isset($buttons[$button_name])) {
        $variables['active_buttons'][$row_number][] = $buttons[$button_name];
        if (empty($buttons[$button_name]['multiple'])) {
          unset($buttons[$button_name]);
        }
      }
    }
  }
  $variables['disabled_buttons'] = array_diff_key($buttons, $variables['multiple_buttons']);
}