You are here

function wysiwyg_yui_button_setting in Wysiwyg 5

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

Create the JavaScript structure for a YUI button.

Parameters

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

$plugin: The internal name of a plugin.

$button: The internal name of a button, defined by $plugin.

$extra: (optional) An array containing arbitrary other elements to add to the resulting button.

1 call to wysiwyg_yui_button_setting()
wysiwyg_yui_settings in editors/yui.inc
Return runtime editor settings for a given wysiwyg profile.

File

editors/yui.inc, line 176

Code

function wysiwyg_yui_button_setting($editor, $plugin, $button, $extra = array()) {
  static $plugins;
  if (!isset($plugins)) {

    // @todo Invoke all enabled plugins, not just internals.
    $plugins = wysiwyg_yui_plugins($editor);
  }

  // Return a simple separator.
  if ($button == 'separator') {
    return array(
      'type' => 'separator',
    );
  }
  $type = 'push';
  if (in_array($button, array(
    'heading',
    'fontname',
  ))) {
    $type = 'select';
  }
  else {
    if (in_array($button, array(
      'fontsize',
    ))) {
      $type = 'spin';
    }
  }
  $button = array(
    'type' => $type,
    'label' => $plugins[$plugin]['buttons'][$button],
    'value' => $button,
  );

  // Add arbitrary other elements, if defined.
  if (!empty($extra)) {
    $button = array_merge($button, $extra);
  }
  return $button;
}