Edit module integration is broken since "edit 7.x-1.0-beta1"


Issue #2111667 by Wim Leers: Backport Drupal 8's Edit module to Drupal 7
removed the $metadata parameter from hook_edit_editor_attachments_alter()
while it is needed in modules/library/dnd/dnd.module for dnd_edit_editor_attachments_alter() (line 239) to work.

Library does not show up anymore. Code fails silently with warning in Watchdog.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jcisio’s picture

Thanks for the bug report. I track that commit and now we can use the new hook_edit_render_field() instead.

nagy.balint’s picture

Since then, the edit module was renamed to quickedit.

However it seems to me that the hook_edit_render_field() is for display only, when after an edit the system shows the rendered field, and not related to the ckeditor itself.

trackleft2’s picture

Any news on updates for this? Quick edit is an easy sell, which in turn sells scald during demos.

nagy.balint’s picture

Unfortunately they have not responded to my problem in their issue queue.

It seems that we can add the dnd to the edit module, but only without checking if the page even needs a dnd. So it would appear all the time even if you dont have any fields requiring it, since the metadata was removed from that function.

nagy.balint’s picture

I tried to get this working.
Ckeditor worked fine, however i was unable to include the dnd library no matter which hook i tried to use.
Seems like the new version works quite differently from the old verison.

nagy.balint’s picture

Actually it worked with dnd_quickedit_editor_attachments_alter, however it only loads the js, and not the css so thats why its not visible :(

nagy.balint’s picture

On the other hand, as far as i can see the attachment alter will load the library even when i did not trigger the quick edit mode yet.

So we could have an alternative workaround where we include the library on node pages if the quick edit is available for that node and dnd is enabled on one of the fields, but we can do that simply on page load and not through quickedit hooks, and that way it could be more reliable.

nagy.balint’s picture

Status: Active » Needs review
FileSize
2.17 KB

So here is the patch that does #7

Basically checking in an entity_view_alter whether we likely going to need the dnd library or not,
like checking all fields if one of them is atom reference or field with the dnd enabled setting, and some other quickedit specific checks and then includes the library.
And since quickedit is loaded through Ajax, the library will stay and remain operational.

nagy.balint’s picture

If anyone is against committing this, let me know.

The hook only does anything when quickedit is enabled, and when there is any chance that it can be needed on a specific piece of entity view. From my tests this workaround worked well.

nagy.balint’s picture

Title: Edit module integration broken - Library not showing up any more » Quickedit module integration - Library not showing up
nagy.balint’s picture

Status: Needs review » Fixed

Committed.

  • nagy.balint committed ee93889 on 7.x-1.x
    Issue #2240027 by nagy.balint: Quickedit module integration - Library...

Status: Fixed » Closed (fixed)

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