Closed (fixed)
Project:
Lost & found issues
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 May 2011 at 13:14 UTC
Updated:
11 May 2011 at 15:23 UTC
Jump to comment: Most recent
As the title states, there's no check if the Wysiwyg Filter is enabled in wysiwyg_filter_wysiwyg_editor_settings_alter();
This bug only applies to TinyMCE
It may cause the Full HTML format to break.
Fix is easy though just added an additional "if" to check for the filter status
change:
/**
* Implementation of wysiwyg_editor_settings_alter().
*/
function wysiwyg_filter_wysiwyg_editor_settings_alter(&$editor_settings, $context) {
// Provide the valid_elements option to TinyMCE editors, only if the WYSIWYG
// Filter is enabled in the input format related to the current given context.
if ($context['profile']->editor == 'tinymce'):
// first get the filters and their settings
if (isset($context['profile']->format)):
$format_name = $context['profile']->format;
$filters = filter_list_format($format_name);
if($filters && array_key_exists('wysiwyg', $filters)):
$filter = $filters['wysiwyg'];
$settings = $filter->settings;
$editor_settings['valid_elements'] = preg_replace('#\s+#', '', $settings['valid_elements']);
endif;
endif;
endif;
}
to:
/**
* Implementation of wysiwyg_editor_settings_alter().
*/
function wysiwyg_filter_wysiwyg_editor_settings_alter(&$editor_settings, $context) {
// Provide the valid_elements option to TinyMCE editors, only if the WYSIWYG
// Filter is enabled in the input format related to the current given context.
if ($context['profile']->editor == 'tinymce'):
// first get the filters and their settings
if (isset($context['profile']->format)):
$format_name = $context['profile']->format;
$filters = filter_list_format($format_name);
if($filters && array_key_exists('wysiwyg', $filters)):
$filter = $filters['wysiwyg'];
$settings = $filter->settings;
if($filter->status != 0) {
$editor_settings['valid_elements'] = preg_replace('#\s+#', '', $settings['valid_elements']);
}
endif;
endif;
endif;
}
Thanks for your nice work with this D7 port!
Comments
Comment #1
geek-merlinhuh, you really should learn git or at least diff ;-)
apart from that: great, slightly modified and committed.
Comment #2
rv0 commentedlol
about git/diff, true.. and actually I do know how to use it.. but I was on a tight time schedule when I made the fix ;)