--- wymeditor.inc	2009-07-08 17:18:13.000000000 +0000
+++ wymeditor.new.inc	2009-07-13 12:30:47.000000000 +0000
@@ -32,6 +32,7 @@ function wysiwyg_wymeditor_editor() {
     'version callback' => 'wysiwyg_wymeditor_version',
     'themes callback' => 'wysiwyg_wymeditor_themes',
     'settings callback' => 'wysiwyg_wymeditor_settings',
+    'plugin callback' => 'wysiwyg_wymeditor_plugins',
     'versions' => array(
       '0.5-rc1' => array(
         'js files' => array('wymeditor.js'),
@@ -108,6 +109,15 @@ function wysiwyg_wymeditor_settings($edi
     $settings['lang'] = $config['language'];
   }
 
+  // Add configured buttons or all available.
+  if (!empty($config['buttons'])) {
+    $buttoninfo = _wysiwyg_wymeditor_button_info();
+    $buttons = array();
+    foreach (array_keys($config['buttons']['default']) as $button) {
+      $settings['toolsItems'][] = array_merge($buttoninfo[$button],array('name' => $button));
+    }
+  }
+
   if (!empty($config['block_formats'])) {
     $containers = array(
       'p' => 'Paragraph',
@@ -145,3 +155,48 @@ function wysiwyg_wymeditor_settings($edi
   return $settings;
 }
 
+/**
+ * Return internal plugins for this editor; semi-implementation of hook_wysiwyg_plugin().
+ */
+function wysiwyg_wymeditor_plugins($editor) {
+  $plugins = array(
+    'default' => array(
+      'buttons' => array(
+        'Bold' => t('Bold'), 'Italic' => t('Italic'),
+        'InsertOrderedList' => t('Ordered List'), 'InsertUnorderedList' => t('Unordered List'),
+        'Outdent' => t('Outdent'), 'Indent' => t('Indent'),
+        'Undo' => t('Undo'), 'Redo' => t('Redo'),
+        'CreateLink' => t('Create Link'), 'Unlink' => t('Unlink'),
+        'InsertImage' => t('Insert Image'),
+        'Superscript' => t('Superscript'), 'Subscript' => t('Subscript'),
+        'Paste' => t('Paste'),
+        'InsertTable' => t('Insert Table'),
+        'ToggleHtml' => t('Toggle Html'),
+        'Preview' => t('Preview'),
+      ),
+    ),
+  );
+  return $plugins;
+}
+
+function _wysiwyg_wymeditor_button_info() {
+  return array(
+    'Bold' => array('title'=> 'Strong', 'css'=> 'wym_tools_strong'), 
+    'Italic' => array('title'=> 'Emphasis', 'css'=> 'wym_tools_emphasis'),
+    'Superscript' => array('title'=> 'Superscript', 'css'=> 'wym_tools_superscript'),
+    'Subscript' => array('title'=> 'Subscript', 'css'=> 'wym_tools_subscript'),
+    'InsertOrderedList' => array('title'=> 'Ordered_List', 'css'=> 'wym_tools_ordered_list'),
+    'InsertUnorderedList' => array('title'=> 'Unordered_List', 'css'=> 'wym_tools_unordered_list'),
+    'Indent' => array('title'=> 'Indent', 'css'=> 'wym_tools_indent'),
+    'Outdent' => array('title'=> 'Outdent', 'css'=> 'wym_tools_outdent'),
+    'Undo' => array('title'=> 'Undo', 'css'=> 'wym_tools_undo'),
+    'Redo' => array('title'=> 'Redo', 'css'=> 'wym_tools_redo'),
+    'CreateLink' => array('title'=> 'Link', 'css'=> 'wym_tools_link'),
+    'Unlink' => array('title'=> 'Unlink', 'css'=> 'wym_tools_unlink'),
+    'InsertImage' => array('title'=> 'Image', 'css'=> 'wym_tools_image'),
+    'InsertTable' => array('title'=> 'Table', 'css'=> 'wym_tools_table'),
+    'Paste' => array('title'=> 'Paste_From_Word', 'css'=> 'wym_tools_paste'),
+    'ToggleHtml' => array('title'=> 'HTML', 'css'=> 'wym_tools_html'),
+    'Preview' => array('title'=> 'Preview', 'css'=> 'wym_tools_preview'),
+  );
+}
