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

geek-merlin’s picture

Status: Needs review » Closed (fixed)

huh, you really should learn git or at least diff ;-)

apart from that: great, slightly modified and committed.

rv0’s picture

lol

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 ;)

Project: » Lost & found issues

This issue’s project has disappeared. Most likely, it was a sandbox project, which can be deleted by its maintainer. See the Lost & found issues project page for more details. (The missing project ID was 1105784)