Drupal 7 confirm_form将标题置于痕迹中

时间:2016-09-08 18:36:35

标签: drupal drupal-7

我有一个自定义模块,显示注册我们的主机事件的用户列表。我添加了一个删除链接,该链接将它们带到confirm_form()页面。工作正常,但它看起来,问题出现在breadcrumb区域。知道是什么导致了这个吗?

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 个答案:

答案 0 :(得分: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;