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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Liam Morland’s picture

Status: Active » Needs review
FileSize
646 bytes
Chris Burge’s picture

Thank 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.

Chris Burge’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
Liam Morland’s picture

Snater’s picture

Status: Reviewed & tested by the community » Closed (outdated)

Form 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.

Liam Morland’s picture

Even without the EIM module, this could be helpful to others and doesn't cost anything. It just makes a more robust API.

Snater’s picture

Status: Closed (outdated) » Active
FileSize
1.09 KB

I 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.

Liam Morland’s picture

Status: Active » Needs review

That looks like a reasonable solution. Thanks.

  • Snater committed 920e5a9 on 7.x-1.x
    Issue #2109357: Trigger insertIntoActiveEditor event on insert button
    
Snater’s picture

Status: Needs review » Fixed

OK, thanks!

Status: Fixed » Closed (fixed)

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