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.
Hi there,
how to make a node/delete confirm modal? I have a view with this link in it..
I add rewrite the link like that node/uid/delete/nojs
but what I have to write in a module, to make this modal?
Comments
Comment #1
Apfel007 CreditAttribution: Apfel007 commentedanyone?
create the modal with this in a view.views-field..
$output = ctools_modal_text_button(t('DELETE'), 'node/' .$row->nid .'/delete', t('delete'));
But it's empty!
How to load the form into the modal? Need a callback .. but how to call it?
create a menu item?
Comment #2
ha5bro CreditAttribution: ha5bro commentedA bit late to the party, but this is really easy using the automodal module. You'll just need to add a class to your delete button using form alter and the rest is automagical.
Comment #3
pfrenssenNo need for the automodal module. This is built in to CTools: #1347578: Allow certain links inside the modal to be able to close the modal.
You need to add the class 'ctools-close-modal' to the links that should close the dialog. An example with a confirm_form():
Comment #5
pringlz CreditAttribution: pringlz commentedModule Modal operaitons do this. https://www.drupal.org/project/modal It is no readme, but here is example. This link was open node view in modal window.
Or this my code for delete node (for Views PHP)
<a href="<?php global $base_url; echo $base_url; ?>/modal/node/<?php echo $row->nid; ?>/delete/nojs" class="ctools-use-modal">Delete</a>