I’m very new to Drupal 7. I have an administration screen created in Views
to edit/delete my custom content type called events.
In my custom module, I’d like to disable the delete button under certain conditions. Is there any hook that I can use for this purpose?
The reason I like to do this is to prevent users from deleting ‘certain’ events.
Inside each user profiles, there is a field that defined which stores that user can edit/view. I like to make it that when people click on the delete button, if that store is not of their stores, they shouldn’t be able to delete it, they should get redirected back with an error message.
Here is the code I have so far:
function my_modue_form_alter(&$form, &$form_state, $form_id){ dpm($form); dpm($form_id); if ($form_id == 'myformid') { unset($form['op']); } }
On the /delete
screen, it doesn’t print out anything.
Here is a screen shot of how the delete node page looks like:
And here is how the URL looks like:
http://example.com/node/123/delete?destination=admin/manage-events
Thanks