Hey everyone,
Quick and simple: how can I make a Drupal path show me a form?
In case you're wondering why in heaven would anyone do that, I just created a custom View with some custom tables, but the objects the view shows are not nodes. So, when I want to create a "Delete" link for each row of the view, the problem is how do I delete them? My answer was to write a confirm form and set the _submit to run a DELETE query, and after that, redirect to my view. The stumbling point is, however, that i haven't found a way to create a path (let's say, "signup/[signup_id]/delete") that will show me the confirm form (let's say, "_mymodule_signup_delete_form"). If it works, I'd be able to add a simple "Global: Custom text" link field to my view and be done with it. That's why.
Any info would be greatly appreciated.
Cheers,
Léster
Comments
You can use hook_menu to
You can use hook_menu to display the form on that link
function my_module_name_menu() {
$items = array();
$items['signup/[signup_id]/delete'] = array(
'page callback' => 'drupal_get_form',
'page arguments' => array('_mymodule_signup_delete_form'),
'access arguments' => array('access content'),
'type' => MENU_NORMAL_ITEM,
);
return $items;
}
let me know if it works
Thanks for your help. No,
Thanks for your help.
Now, when I clock in the "Delete" link in my view, it shows an "Access denied" page.
The link generated in my view is http://localhost/drupal/inscripcion/delete/1
My code:
Any advice would be greatly appreciated.
Léster
You have commented the
You have commented the 'access arguments' => array('access content'), in ur code so its giving u tht error just uncomment tht line and it would work.
Solved!
Solved. Just had to change hook_menu to this:
and make corresponding changes in my form.