You are here

function editor_attach in Editor 6

Same name and namespace in other branches
  1. 5 editor.module \editor_attach()

File

./editor.module, line 96
Extendable WYSIWYG editor @author Tj Holowaychuk <http://www.350designs.com/> @package Editor

Code

function editor_attach() {
  $plugins = editor_invoke_plugins();
  $profile = editor_profile_get('large');
  $module_path = drupal_get_path('module', 'editor');

  // Settings
  $data = array(
    'editor' => array(
      'toolbars' => editor_display_toolbars($profile),
    ),
  );

  // Plugin settings
  if (count($plugins)) {
    foreach ($plugins as $plugin) {
      $data['editor']['plugins'][$plugin->pid] = $plugin;
    }
  }

  // @todo: check permissions, styles etc
  drupal_add_css($module_path . '/editor.css');
  drupal_add_js($module_path . '/editor.js');
  drupal_add_js($module_path . '/editor.plugins.js');
  drupal_add_js($data, 'setting');
}