Sorry, that title is not very clear.

Thanks in advance for any help - very much appreciated.

If I add a Wysiwyg imagefield to the wysiwyg all is good as on hitting the button the nice popup appears to let me choose the images from ones I'd uploaded before etc using the views of filefield sources.

However, if I then add another imagefield to the node that is not to be used with the wysiwyg, and I enable the filefield sources - I get a broken version of the nice views enabled options. It shows the view but doesn't let you select one. Also, the autocomplete box disappears. I've attached a screenshot to give you an idea.

However, it gets more complicated. If I uncheck the use for wysiwyg checkbox the broken view appears to choose from, but this time the autocomplete box appears, the second (and actually any further imagefields) also have the autocomplete box, but if I make one used in the wysiwyg the autocomplete box disappears. I've attached a second screenshot.

If I disable wysiwyg imagefield, the filefields return to normal filefield sources ui. (ie no views browser at all)

I understand that there is work going on to look at whether the views browser should sit with filefield sources, and I understand there's a patch for filefield sources. I was wondering if that patch would solve this problem - and if using that patch would clash with the views browser provided by wysiwyg imagefield?

thanks

Thomas

Comments

seanberto’s picture

Subscribing. I'm guessing this is b/c there's no checks to see if WYSIWYG image field is set for the field before retheming the filefield sources output in filefield_sources.inc:

/**
 * Theme the output of the autocomplete field.
 */
function theme_wysiwyg_imagefield_filefield_source_reference_element($element) {
  drupal_add_js(drupal_get_path('module', 'wysiwyg_imagefield') . '/modules/filefield_sources.js');
  $element['autocomplete']['#field_suffix'] = theme('submit', $element['select']);

  if (module_exists('views')) {
    $view = views_get_view('wysiwyg_imagefield');
    $view->pager['use_pager'] = TRUE;
    $view->use_ajax = TRUE;

    return '<div class="filefield-source filefield-source-reference clear-block"><span class="wysiwyg_imagefield-hidden">' . theme('textfield', $element['autocomplete']) . '</span>' . $view->render('default') . '</div>';
  }

  else {
    return '<div class="filefield-source filefield-source-reference clear-block">' . theme('textfield', $element['autocomplete']) . '</div>';
  }
}

I think that a quick check here is all that's needed. Or, you could go the long way of adding the jquery dialog stuff for non-wysiwyg editors, but that seems to extend beyond the scope of this module.