clarity-h2020 / csis-helpers-module

CSIS Helpers Drupal Module
GNU General Public License v3.0
1 stars 0 forks source link

Opening Edit-form as modal not working for links created by the module #8

Closed patrickkaleta closed 5 years ago

patrickkaleta commented 5 years ago

The openEditForm function creates a link just like the ones on the Summary-Tab, which open the edit-forms for Report Images via Ajax as a modal.

However, this doesn't seem to work and the "use-ajax" class in the link gets ignored and a complete page-load is triggered instead. Not a major bug, since the user is taken back to the correct page after he/she saves the edit-form. But it's still ugly that way.

@fgeyer16 Any idea why this is not working?

fgeyer16 commented 5 years ago

After creating the link, it is just a link in the html. The popup functionality is added to the use-ajax links by js after loading the document. SInce the document is already loaded, the additional onclick handler is not added to the link. If drupal does not make an exception from its own recommendations to use behaviors I think this could fix it: add Drupal.attachBehaviors(link, Drupal.settings); after completing its creation. Then the popup stuff should be added. Theoretically you do not need to attach all behaviors to that link, but only the right ones. But this needs some very deep research into drupal ;-)

patrickkaleta commented 5 years ago

@fgeyer16 thanks, this fixed the problem. Now it's working as expected :-)