Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm sure I'm no the only person that has struggled for a while wondering why my insert module doesn't work, only to realise it's because I don't have the image tag in my html filter list.
Is it maybe an idea to ask the user whether it should be added, and to which filter?
Or is there a reason this isn't done?
Comment | File | Size | Author |
---|---|---|---|
#3 | insert_img_warning-d6.patch | 4.84 KB | quicksketch |
#3 | insert_img_warning-d7.patch | 4.8 KB | quicksketch |
Comments
Comment #1
quicksketchI don't think this is really a job for Insert module. Insert doesn't have any concept of input/text formats and it doesn't know which tags are allowed on which fields. It only inserts tags into textareas. Considering the customizations available (like Better Formats) which may hide the tag help from the HTML (plus theming that might do the same thing), I don't think Insert has a reliable source of this information (which means we'd need to add one). It's a lot of overhead for something that's only tangentially related.
Comment #2
quicksketchActually I was thinking more about this with a colleague. In reality, no module is going to claim responsibility for identifying this problem, since it's a hard problem to identify 100% of the time. However users of Insert commonly make this mistake, and we could probably solve the problem for 90% fairly easily. If the check fails because filter tips are hidden or there's only one input format, we can just bail on the check and not give an error at all.
So reconsidering I think we can give this a shot, I'll put together a patch and see how difficult this 90% case is.
Comment #3
quicksketchI've applied this pair of patches which gives the user an error if they insert an image into a text format that doesn't support it. Overall I think this is a good improvement. The error isn't pretty, but it's extremely helpful that the user is at least warned that their image isn't going to work.
Comment #5
Ankabout CreditAttribution: Ankabout commentedOnly see this message now, but thanks quicksketch, looks like a great solution! Like you said, a small problem/solution, but will help a lot of people. Sometimes the small fixes have the biggest impacts.
Comment #6
Ankabout CreditAttribution: Ankabout commentedDouble-post