imce_wysiwyg.module in IMCE Wysiwyg bridge 5
Same filename and directory in other branches
Makes IMCE available as plugin for client-side editors integrated via Wysiwyg API.
File
imce_wysiwyg.moduleView source
<?php
/**
* @file
* Makes IMCE available as plugin for client-side editors integrated via
* Wysiwyg API.
*/
/**
* Implementation of hook_wysiwyg_plugin().
*/
function imce_wysiwyg_plugin($editor, $version) {
static $integrated = array();
if (!user_access('access imce')) {
return;
}
// Load our invocation scripts.
$imcepath = drupal_get_path('module', 'imce');
if (empty($integrated)) {
$path = drupal_get_path('module', 'imce_wysiwyg');
drupal_add_js($path . '/js/imce_wysiwyg.js');
}
switch ($editor) {
case 'tinymce':
if (!isset($integrated[$editor])) {
$integrated[$editor] = TRUE;
drupal_add_js($imcepath . '/imce_set_tinymce.js');
// @todo If some other editor also needs the URL to be passed via
// Drupal.settings.imce, then we need another sub-key '$editor'.
$settings = array(
'imce' => array(
'url' => url('imce', array(
'query' => array(
'app' => $editor . '|url@',
),
)),
),
);
drupal_add_js($settings, 'setting');
drupal_add_js('var imceBrowserURL = "' . url('imce/browse') . '";', 'inline');
}
return array(
'imce' => array(
'extensions' => array(
'imce' => t('IMCE'),
),
'url' => 'http://drupal.org/project/imce',
'options' => array(
'file_browser_callback' => 'imceImageBrowser',
'inline_styles' => TRUE,
),
'load' => FALSE,
),
);
case 'ckeditor':
$integrated[$editor] = TRUE;
return array(
'imce' => array(
'extensions' => array(
'imce' => t('IMCE'),
),
'url' => 'http://drupal.org/project/imce',
'options' => array(
'filebrowserBrowseUrl' => url('imce', array(
'query' => array(
'app' => $editor . '|sendto@imceCkeditSendTo|params@',
),
)),
),
'load' => FALSE,
),
);
case 'fckeditor':
if (!isset($integrated[$editor])) {
$integrated[$editor] = TRUE;
drupal_add_js($imcepath . '/imce_set_fck.js');
}
return array(
'imce' => array(
'extensions' => array(
'imce' => t('IMCE'),
),
'url' => 'http://drupal.org/project/imce',
'options' => array(
'LinkBrowser' => TRUE,
'LinkBrowserURL' => url('imce', array(
'query' => array(
'app' => $editor . '|url@txtUrl',
),
)),
'ImageBrowser' => TRUE,
'ImageBrowserURL' => url('imce', array(
'query' => array(
'app' => $editor . '|url@txtUrl|width@txtWidth|height@txtHeight',
),
)),
'FlashBrowser' => TRUE,
'FlashBrowserURL' => url('imce', array(
'query' => array(
'app' => $editor . '|url@txtUrl',
),
)),
),
'load' => FALSE,
),
);
}
}
Functions
Name![]() |
Description |
---|---|
imce_wysiwyg_plugin | Implementation of hook_wysiwyg_plugin(). |