2016-09-08 71 views
1

我有一個自定義模塊,顯示註冊我們的主機事件的用戶列表。我添加了一個刪除鏈接,鏈接將它們帶到confirm_form()頁面。工作正常,但它看起來不錯,問題顯示在麪包屑區域。任何想法是什麼造成這個?Drupal 7 confirm_form將標題放入麪包屑中

return confirm_form(
    $form, 
    t('Are you sure you want to delete this?'), 
    '<front>', 
    t('This action cannot be undone.'), 
    t('Delete'), 
    t('Cancel') 
); 

enter image description here

更新:我能得到它的工作,如果我用我自己的方式:

$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; 

回答

1

如果你看一下該confirm_form() function包含的代碼,你會發現它調用drupal_set_title($question)它設置頁面標題。
您可以在致電confirm_form後致電drupal_set_title('something here')解決此問題。

例如。

$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; 
+0

謝謝! @ 2pha – Johanna