I have a custom module that displays a list of users who registered for our hosts events. I added a delete link and the link takes them to the confirm_form()
page. Works fine but it looks off, the question is showing up in the breadcrumb area. Any idea what is causing this?
return confirm_form(
$form,
t('Are you sure you want to delete this?'),
'<front>',
t('This action cannot be undone.'),
t('Delete'),
t('Cancel')
);
Update: I can get it working if I use my own form:
$form['id'] = array(
'#type' => 'value',
'#value' => $id,
);
$form['header'] = array
(
'#markup' => t('Are you sure you wish to delete?'),
'#prefix' => '',
'#suffix' => '',
);
$form['warning'] = array
(
'#markup' => t(' Warning, this action cannot be undone'),
'#prefix' => '',
'#suffix' => '',
);
$form['delete_button'] = array
(
'#type' => 'submit',
'#value' => t('Delete item'),
);
return $form;
If you look at the code that the confirm_form() function contains, you will notice it calls drupal_set_title($question)
which sets the page title.
You could just get around it by calling drupal_set_title('something here')
after your call to confirm_form.
eg.
$cform = confirm_form(
$form,
t('Are you sure you want to delete this?'),
'<front>',
t('This action cannot be undone.'),
t('Delete'),
t('Cancel')
);
drupal_set_title('something');
return $cform;