Allowing the TinyMCE scripts to be outside of the module folder

zeropaper - May 29, 2009 - 10:03
Project:Tiny Tiny MCE
Version:6.x-1.12
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

To ease the maintenance of sites I would make possible to have the third party scripts (generally speaking, this should, to me, applies to every modules) outside of the module directories.
For example

  • sites
    • example.com
      • files
      • settings.php
      • themes
    • all
      • modules
        • getid3
        • tinytinymce
        • views
        • ...
      • thirdparty
        • getid3
        • tinymce
        • ...

For Tiny Tiny MCE I just had to made a small modification to the tinytinymce.module file

  1. Adding:
    <?php
        $form
    ['tinytinymce_scripts_path'] = array(
         
    '#type' => 'textfield',
         
    '#default_value' => variable_get('tinytinymce_scripts_path', drupal_get_path('module', 'tinytinymce') .'/tinymce/jscripts/tiny_mce/tiny_mce.js'),
         
    '#title' => t('Location of tiny_mce.js'),
        );
    ?>
    in tinytinymce_admin()
  2. Changing:
    <?php
             $path
    = drupal_get_path('module', 'tinytinymce');
            
    drupal_add_js($path.'/tinymce/jscripts/tiny_mce/tiny_mce.js', 'module', 'header', false, true, false);
    ?>
    to
    <?php
            
    /*
             $path = drupal_get_path('module', 'tinytinymce');
             drupal_add_js($path.'/tinymce/jscripts/tiny_mce/tiny_mce.js', 'module', 'header', false, true, false);
             */
            
    $path =variable_get('tinytinymce_scripts_path', drupal_get_path('module', 'tinytinymce') .'/tinymce/jscripts/tiny_mce/tiny_mce.js');
            
    drupal_add_js($path, 'module', 'header', false, true, false);
    ?>
    in tinytinymce_theme_textarea()

Of course some "help / instructions" have to be changed too.
An other advantage of this is to be able to easly switch between 2 versions of TinyMCE...
Do you like it?

 
 

Drupal is a registered trademark of Dries Buytaert.