Imagefield button appears at editor toolbar (tested with ckeditor, 3.6 version). Unfortunately, if user submit form using "preview" button, imagiefield button will disappear from ckeditor.
The major reason behind this is a fact, that in such situation wysiwyg module doesn't load wysiwyg_imagefield plugin at all. This is because a these two parts of code:
hook_form_alter implementation:
// Attach jQuery UI Dialog to node forms.
if (isset($form['type']['#value']) && $form_id == "{$form['type']['#value']}_node_form" && !is_null(variable_get("wysiwyg_imagefield_{$form['#node']->type}",
NULL))) {
$_SESSION['wysiwyg_imagefield'] = TRUE;
$form['#after_build'][] = 'wysiwyg_imagefield_after_build';
}
and this one
/**
* Implements hook_INCLUDE_plugin().
*/
function wysiwyg_imagefield_wysiwyg_imagefield_plugin() {
$plugins = array();
// Define plugin if $_SESSION['wysiwyg_imagefield'] is set or page is Wysiwyg profile form.
if (isset($_SESSION['wysiwyg_imagefield']) || strpos(request_uri(), 'admin/settings/wysiwyg') >= 1) {
The hook_form_alter implementation is called on full build of form. After that, form is cached. Preview and validation actions doesn't rebuild form fully and doesn't execute hook_form_alter. So, at preview, we have situation, where $_SESSION['wysiwyg_imagefield'] is uninitialized and plugin isn't loaded. This lead to described problem.
In few moments I will attach simple bugfix (more workaround that clean solution).
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | wysiwyg_imagefield-no_button_at_preview-1436328-1.patch | 690 bytes | jsobiecki |
Comments
Comment #1
jsobiecki commentedPatch at attachment
Comment #1.0
jsobiecki commentedRemoved some typos
Comment #1.1
jsobiecki commentedFixed next typo