You are here

function wysiwyg_yui_settings in Wysiwyg 6

Same name and namespace in other branches
  1. 5.2 editors/yui.inc \wysiwyg_yui_settings()
  2. 5 editors/yui.inc \wysiwyg_yui_settings()
  3. 6.2 editors/yui.inc \wysiwyg_yui_settings()
  4. 7.2 editors/yui.inc \wysiwyg_yui_settings()

Return runtime editor settings for a given wysiwyg profile.

Parameters

$editor: A processed hook_editor() array of editor properties.

$config: An array containing wysiwyg editor profile settings.

$theme: The name of a theme/GUI/skin to use.

Return value

A settings array to be populated in Drupal.settings.wysiwyg.configs.{editor}

1 string reference to 'wysiwyg_yui_settings'
wysiwyg_yui_editor in editors/yui.inc
Plugin implementation of hook_editor().

File

editors/yui.inc, line 107

Code

function wysiwyg_yui_settings($editor, $config, $theme) {
  $settings = array(
    'theme' => $theme,
    'dompath' => $config['path_loc'],
    'animate' => TRUE,
    'handleSubmit' => TRUE,
    'markup' => 'xhtml',
    'ptags' => TRUE,
    'toolbar' => array(
      'collapse' => FALSE,
      'buttonType' => 'simple',
    ),
  );
  if (isset($config['buttons'])) {
    $buttons = array();
    foreach ($config['buttons'] as $plugin => $enabled_buttons) {
      foreach ($enabled_buttons as $button => $enabled) {
        $extra = array();
        if ($button == 'heading') {
          $extra = array(
            'menu' => array(
              array(
                'text' => 'Paragraph',
                'value' => 'p',
                'checked' => TRUE,
              ),
              array(
                'text' => 'Header 1',
                'value' => 'h1',
              ),
              array(
                'text' => 'Header 2',
                'value' => 'h2',
              ),
              array(
                'text' => 'Header 3',
                'value' => 'h3',
              ),
              array(
                'text' => 'Header 4',
                'value' => 'h4',
              ),
              array(
                'text' => 'Header 5',
                'value' => 'h5',
              ),
              array(
                'text' => 'Header 6',
                'value' => 'h6',
              ),
            ),
          );
        }
        else {
          if ($button == 'fontstyle') {
            $extra = array(
              'menu' => array(
                array(
                  'text' => 'Arial',
                  'checked' => TRUE,
                ),
                array(
                  'text' => 'Arial Black',
                ),
                array(
                  'text' => 'Comic Sans MS',
                ),
                array(
                  'text' => 'Courier New',
                ),
                array(
                  'text' => 'Lucida Console',
                ),
                array(
                  'text' => 'Tahoma',
                ),
                array(
                  'text' => 'Times New Roman',
                ),
                array(
                  'text' => 'Trebuchet MS',
                ),
                array(
                  'text' => 'Verdana',
                ),
              ),
            );
          }
        }
        $buttons[] = wysiwyg_yui_button_setting($editor, $plugin, $button, $extra);
      }
    }

    // Group triggers an JS error for any reason. 06/12/2008 sun
    // $settings['toolbar']['buttons'][] = array('group' => 'default', 'label' => '', 'buttons' => $toolbar);
    // JS error disappears when adding another button, but not when adding a
    // separator. 06/12/2008 sun
    // $settings['toolbar']['buttons'][] = wysiwyg_yui_button_setting($editor, 'default', 'separator');
    $settings['toolbar']['buttons'] = $buttons;
  }
  return $settings;
}