You are here

function elfinder_wysiwyg_plugin in elFinder file manager 6

Same name and namespace in other branches
  1. 8.2 elfinder.module \elfinder_wysiwyg_plugin()
  2. 6.2 elfinder.module \elfinder_wysiwyg_plugin()
  3. 7.3 elfinder.module \elfinder_wysiwyg_plugin()
  4. 7 elfinder.module \elfinder_wysiwyg_plugin()
  5. 7.2 elfinder.module \elfinder_wysiwyg_plugin()

Implements hook_wysiwyg_plugin().

File

./elfinder.module, line 453

Code

function elfinder_wysiwyg_plugin($editor, $version) {
  $path = drupal_get_path('module', 'elfinder');
  drupal_add_js($path . '/js/helper.js');
  $options = array(
    'elfinder_url' => url('elfinder', array(
      'query' => array(
        'app' => $editor,
      ),
      'language' => language_default(),
    )),
    'homepage_url' => elfinder_homepage_url(),
    'path' => $path,
  );

  /* bueditor hack */
  if (preg_match('/^(bueditor|bue)/', $editor)) {
    $editor = 'bueditor';
  }
  $editor_plugins = elfinder_system_listing("{$editor}\\.inc\$", $path . '/editors', 'name', 0);

  /* loading editor plugin */
  $plugin_file = '';
  if (isset($editor_plugins[$editor])) {
    $plugin_file = $editor_plugins[$editor]->filename;
    if ($plugin_file) {
      $options['plugin_url_base'] = "{$path}/editors/{$editor}";
      require_once $plugin_file;
    }
  }

  /* hook for adding another editor support */

  //module_invoke_all('elfinder_editor_plugin');

  /* wysiwyg plugin generation func for selected editor */
  $pluginfunc = 'elfinder_' . $editor . '_elfinder_editor_plugin';

  /* returning elFinder wysiwyg editor plugin for selected editor */
  if (function_exists($pluginfunc)) {
    return call_user_func_array($pluginfunc, array(
      $options,
    ));
  }
}