Totally Zenned
- Join Date:
- Jun 2005
- Location:
- Kelowna, BC Canada
- Posts:
- 1,033
- Plugin Contributions:
- 4
Bug in custom editor logic (I think. At least typo in documentation)
I'll start with the typo.
in admin\includes\init_includes\init_html_editor.php there is the following hint/comments:
/**
- List of potential editors apps
- CONSTANTS are used for language-specific display names, and are defined in /YOUR_ADMIN_FOLDER/includes/languages/extra_definitions/editor_EDITORNAME.php
- To add additional editors, add your own entries to the $editors_list array by creating a NEW FILE in /YOUR_ADMIN_FOLDER/includes/extra_functions/editor_EDITORNAME.php containing just one line of PHP:
- <?php $editors_list['NAME_OF_EDITOR'] = array('desc' => EDITOR_CONSTANT, 'handler' => 'editorhandlerfilename.php', 'special_needs' => '');
- NOTE: THERE SHOULD BE NO NEED TO EDIT ANYTHING BELOW THIS LINE:
*/
It would seem to me the paths of the language and function is missing a level. It should read (I think):
/**
- List of potential editors apps
- CONSTANTS are used for language-specific display names, and are defined in /YOUR_ADMIN_FOLDER/includes/languages/english/extra_definitions/editor_EDITORNAME.php
- To add additional editors, add your own entries to the $editors_list array by creating a NEW FILE in /YOUR_ADMIN_FOLDER/includes/functions/extra_functions/editor_EDITORNAME.php containing just one line of PHP:
- <?php $editors_list['NAME_OF_EDITOR'] = array('desc' => EDITOR_CONSTANT, 'handler' => 'editorhandlerfilename.php', 'special_needs' => '');
- NOTE: THERE SHOULD BE NO NEED TO EDIT ANYTHING BELOW THIS LINE:
*/
Making that change got me somewhere, but I was still having trouble getting the friendly name of the editor to be shown in the drop-down. I think I discovered that, perhaps, the functions are being read in before the language defines, but they use the language defines so it ends up reporting the constant name as a literal instead of the string it represents. In other words, "EDITOR_CONSTANT" would be shown in the drop-down instead of "my test" (despite the constant being properly registered, as confirmed by a simply echo test in any file that loads after the languages). I can "fix" this by putting the define in the function, something like this:
<?php
define("EDITOR_TEST", "Test");
$editors_list['TEST'] = array('desc' => EDITOR_TEST, 'handler' => 'test.php', 'special_needs' => '');
``` but clearly that's not the proper way to do it.
Did I do something wrong? I'm fairly sure this is a bug and you'll see if you attempt to follow your own instructions, exactly and/or with my modifications, for adding an editor.