On some reason I ave this notice on my site:

Notice: Undefined variable: format_id in /home/elias/sites/otpusk.ru/sites/all/modules/wysiwyg/wysiwyg.module on line 211

I think on this place should be $format_field['#id'] (or maybe $format_field['format']['#id'])

CommentFileSizeAuthor
wysiwyg.patch561 bytesistankevych

Comments

twod’s picture

Status: Needs review » Closed (cannot reproduce)

That variable is defined on line 178:

// Determine the available text formats.
  foreach ($format_field['format']['#options'] as $format_id => $format_name) {
    $format = 'format' . $format_id;

It's not the id of the field, but the id of the formats allowed for that field: for example $format_field['format']['#options']['filtered_html'].

Have you changed anything in wysiwyg.module or applied any patch which might have?
Please remove sites/all/modules/wysiwyg and extract the 7.x-2.1 version of the module there again (no need to uninstall/reinstall) and try again.

panuv’s picture

Line 211 is out-of-scope for the foreach ($format_id set on 178). If there's no ['format']['#options'], then this is unset. (and if there is, it is taking the last $format_id). And it's the fallback to the situation where user cannot set the comment format himself.

One suggestion: to use filter_fallback_format()?

panuv’s picture

Status: Closed (cannot reproduce) » Needs review
twod’s picture

Status: Needs review » Closed (duplicate)

A couple of patches got in so the line numbers are different now. $format_id is now set on 194 and used on 205 and posibly 227, depending on whether the user has access to the format selector or not.

['format']['#options'] should always be set since if the user has access to only one format, it should still be in the list of allowed formats.

Anyway, we've got a patch to simplify this in #934976: Provide method to hide input format fields without disabling WYSIWYG so I'll mark this as a duplicate. Please follow that issue to know when the patch gets in (and verify it actually fixes the issue for you).