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 am working on fixing #2085699: Insert module support only uses settings from first image field when there is more than one image field in the content type. in the EIM module. For that, I need access to the field name that is being inserted when insertIntoActiveEditor is called.
Comment | File | Size | Author |
---|---|---|---|
#7 | insert-2109357-insertIntoActiveEditor_event.patch | 1.09 KB | Snater |
#1 | insert_2109357_field_name.patch | 646 bytes | Liam Morland |
Comments
Comment #1
Liam MorlandComment #2
Chris Burge CreditAttribution: Chris Burge commentedThank you for contributing this patch. I have deployed it in conjunction with #2085699: Insert module support only uses settings from first image field when there is more than one image field in the content type.. It tests successful for me.
Comment #3
Chris Burge CreditAttribution: Chris Burge commentedComment #4
Liam MorlandComment #5
Snater CreditAttribution: Snater commentedForm the perspective of the Insert module, the change seems to be out of place. The EIM module should rather inject the required information by itself. The Insert button could just be disabled as long as the alt field is not filled. (This also is the behaviour of in the module's D8 version where the option to require alt field input is part of Drupal core.)
Anyway, closing this ticket as the EIM module seems to be sort of abandoned, most recent change was five years ago.
Comment #6
Liam MorlandEven without the EIM module, this could be helpful to others and doesn't cost anything. It just makes a more robust API.
Comment #7
Snater CreditAttribution: Snater commentedI appreciate your reply. Since I am not the original D7 developer, I had another look at the code and I see the issue now. In the sense of separation of concerns I would not extend the event options by adding processing not directly related to the Insert module, as that actually makes the interface less robust. But I wonder why the
insertIntoActiveEditor
event is not triggered on a meaningful node (which is what I had expected). Indeed, currently, there is no way to access the field environment.Triggering the event on the Insert button would allow event handlers to easily access the field environment. In my opinion, that would be a sensible solution in that particular case and an improvement in any case. Now, in the event handler,
event.target
could be used to access the field environment crawling the DOM. If you are fine with that change, I will merge it in.Comment #8
Liam MorlandThat looks like a reasonable solution. Thanks.
Comment #10
Snater CreditAttribution: Snater commentedOK, thanks!