We're using Visual Select File on a site, but hitting problems with it when used for webform settings fields, specifically the "Confirmation message" field found at /node/<nid>/webform/configure

The VSF icon is shown correctly in the ckEditor toolbar, however clicking on it yields the following JS error:

Uncaught TypeError: Object #

has no method 'openModal'
The problem appears to be that visual_select_file.js is NOT loaded on that page. This seems to be down to the logic in visual_select_file_pre_render_wysiwyg_element(). Action is only taken here if $element['#entity_type'] is set, which it isn't for the confirmation field on the webform settings. Any advice welcome.

Comments

rudiedirkx’s picture

Category: Bug report » Feature request

Eeeeeh. yeah I only had Fields in mind, not other wysiwyg loads... I don't know how to fix and I'm not working with VSF at this time, so I'm not fixing it any time soon. Maybe alter the element registry and add a pre_render for all wysiwyg fields and then load VSF even without entity context.

If you do fix it, patch it, I'll commit it. I suppose a Field isn't strictly necessary to load VSF (just has less context then), so shouldn't be too hard..? Famous last words.

rudiedirkx’s picture

Any work here? Would still be a cool addition. I'm working on VSF again, so I'll look into it some time soon.

rudiedirkx’s picture

Title: Javascript error on webform confirmation message form element » VSF support on non-Field elements (text_format and file)
leewillis77’s picture

Hi,

Sorry for the delay replying. I wasn't part of the project team on this site build, so I had to check with a few people. It appears that we worked around this issue - it wasn't enough of a deal-breaker for us to spend significant time on I'm afraid.

I think it would be nice to have, but not urgent for us (Feel free to deprioritise / close if you'd like).

rudiedirkx’s picture

Status: Active » Fixed

VSF now (dev, 1.7 soon) works on every WYSIWYG field that has the right metadata. There are 2 ways to define that metadata:

  • hackish: add #entity_type, #bundle and #field_name to the element, this will fool VSF into thinking it's a real field. All 3 can be "custom" or anything you like.
  • the right way: add #vsf_file_usage_type and #vsf_file_usage_id to enable free file usage tracking.

More info in the api.php.

VSF on file element is much trickier, because VSF uses Filefield Sources for its submission logic. Patches very welcome.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.