Skip to main content
9 events
when toggle format what by license comment
Apr 12, 2020 at 21:28 comment added No Sssweat Make a new question on that, not enough room in comments to properly explain.
Apr 12, 2020 at 17:33 comment added gbmapo @No Sssweat I'm afraid my skills about jQuery are very limited... Where do I put $(".use-ajax").click();? In the modal.js I attached this way : $variables['#attached']['library'][] = 'shared/modal';? I tried but when I load the page, I get this error: TypeError: $ is not a function.
Apr 12, 2020 at 15:24 comment added No Sssweat @gbmapo you can make jQuery to click the link for you on page load $(".use-ajax").click();
Apr 12, 2020 at 15:06 comment added gbmapo I updated my question with the last results I get using your advice...
Apr 12, 2020 at 13:35 comment added leymannx @gbmapo – I found drupal.org/docs/8/api/ajax-api/ajax-dialog-boxes where you can find more information on how to actually use it. From where you attach the library depends a little bit on the circumstances. Sounds a bit as if you might want to attach it to some field that references the other node maybe. But you could simply add it to your themes's info file as well.
Apr 12, 2020 at 13:32 history edited leymannx CC BY-SA 4.0
Added sample
Apr 12, 2020 at 12:56 comment added gbmapo I hear you. I understand that I have to attach the library ($something['#attached']['library'][] = 'core/drupal.dialog.ajax';). But I don't know how to do that when I want it only on a specific node. Do I have to create a .js file with $( function() {$( "#dialog" ).dialog();} );in it and add both this file and the core/drupal.dialog.ajax dependencie to my module library? In this case, how to choose the node I want to display the popup when the nodeis displayed?
Apr 12, 2020 at 12:53 history edited No Sssweat CC BY-SA 4.0
fixed URL of link #6
Apr 12, 2020 at 8:31 history answered leymannx CC BY-SA 4.0