You are here

function linkit_wysiwyg_editor_settings_alter in Linkit 7.3

Implements hook_wysiwyg_editor_settings_alter().

File

./linkit.module, line 1040
Main file for Linkit module.

Code

function linkit_wysiwyg_editor_settings_alter(&$settings, $context) {
  if ($context['profile']->editor == 'ckeditor') {
    $button_exists = isset($context['profile']->settings['buttons']['linkit']);
    if (!empty($context['profile']->settings['default_toolbar_grouping']) && $button_exists) {
      foreach ($settings['toolbar'] as &$group) {
        if ($group['name'] == 'links') {
          array_unshift($group['items'], 'linkit');
        }
        if ($group['name'] == 'other') {
          if (in_array('linkit', $group['items'])) {
            unset($group['items'][array_search('linkit', $group['items'])]);

            // Regenerate the keys.
            $group['items'] = array_values($group['items']);
          }
        }
      }
    }
  }
}