When there is only a single format possible and thus access to the format select box is disabled, the wysiwyg module adds a hidden input field containing that format, so the related JS knows which wysiwyg profile to initialize.
from wysiwyg.module:
if (!$format_field['format']['#access']) {
$format_field['wysiwyg'] = array(
'#type' => 'hidden',
'#name' => $format_field['format']['#name'],
'#value' => $format_id,
'#attributes' => array(
'id' => $format_field['format']['#id'],
'class' => array('wysiwyg'),
),
);
However, under certain circumstances the better formats module disables the whole format fieldset, in which this hidden input field was inserted by wysiwyg, through its #access property.
from better_formats.module:
// Hide the entire text format fieldset if the user is not supposed to see
// anything inside it.
if (!$show_selection && !$show_tips && !$show_tips_link) {
$element['format']['#access'] = FALSE;
}
wysiwyg's JS now doesn't know anymore about the format and doesn't initialize any editor at all.
I found several related issues here in the queue but none of them came to the point of clarifying the issue properly or were related to D6 so I thought reporting a new one would be a better idea.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | better_formats-wysiwyg_hidden_input_removed-1699846-4.patch | 555 bytes | rocketeerbkw |
Comments
Comment #1
dragonwize commentedConfirmed.
I dealt with this in D6 but the code was recently switched to an run after instead of a run instead of. It needs to have the same idea done as D6.
Comment #2
dragonwize commentedChanged the fieldset to a container instead of disabling access.
Committed. Thanks.
Comment #4
rocketeerbkw commentedI believe there is another place this needs to be fixed:
This is causing my issues in #1715790: Text Editor Is Missing For All Users Except Admin since this early in the code there's no way to know if there is only one Text Format available and when
$element['format']['format']['#access'] = FALSE;is used, WYSIWYG will assume there is only one Text Format.Edit: I spoke too soon, it looks like
$element['format']['#type'] = 'container';won't hide anything at all. I believe that removing the#accessis correct for both locations, but something other than changing#typeto container needs to be used.Comment #5
rocketeerbkw commentedHow many times am I allowed to flip flop on an issue? I think there's a bug in WYSIWYG related to setting
#accessto FALSE and having multiple text formats available. See #934976: Provide method to hide input format fields without disabling WYSIWYGWith that issue fixed,
$element['format']['format']['#access'] = FALSE;becomes the approved method for disabling format selector and not breaking WYSIWYG. So you should actually revert the orginal fix in this issue and use$element['format']['format']['#access'] = FALSE;.Comment #5.0
rocketeerbkw commentedFixed formatting and mentioned the files containing code extracts.
Comment #6
fonant commentedI get this problem, to use the WYSIWYG editor for node bodies the user has to have the "Show format selection for nodes" permission, which then keeps the format selector and thus the WYSIWYG editor JS is added.
I have found that standard Better Formats, with WYSIWYG 7.x-2.2, plus the wysiwyg-one-format.934976.23-alt.patch patch from #934976-23: Provide method to hide input format fields without disabling WYSIWYG fixes this problem.