Drupal 7 Drupal Ctools模式处理

Drupal 7 Drupal Ctools模式处理,drupal-7,drupal-modules,drupal-ctools,Drupal 7,Drupal Modules,Drupal Ctools,我正在使用URL调用一个函数,该函数将返回html格式的表单,我在自定义模块的corresponfin回调函数中使用以下函数 $form_state = array( 'ajax' => TRUE, 'title' => t("Edit : $ID"), ); $output = ctools_modal_form_wrapper('form_fn', $form_state); print ajax_render($output); drupal_exit(); 我使用这

我正在使用URL调用一个函数,该函数将返回html格式的表单,我在自定义模块的corresponfin回调函数中使用以下函数

$form_state = array(
  'ajax' => TRUE,
  'title' => t("Edit : $ID"),
);
$output = ctools_modal_form_wrapper('form_fn', $form_state);
print ajax_render($output);
drupal_exit();

我使用这个输出在twitter引导模式中创建一个表单。问题是,当我提交时,我再次得到一个我无法处理的ajax输出。我想根据表单提交功能显示成功消息或失败消息。是否有任何方法可以使用模式显示输出,或在调用模式的原始页面上显示输出。

调用ctools模式应如下所示:

  $output = ctools_modal_form_wrapper($form_name, $form_state);
  if(!empty($form_state['executed'])) {
    $output = array();
    $output[] = ctools_modal_command_display(t('Successful message title'), 'Successful message body');
    $output[] = ctools_ajax_command_reload();
  }
  print ajax_render($output);
  exit;
不要忘记检查
$form\u state['executed']

另外,如果您使用
ctools\u ajax\u命令\u reload()
,这将重新加载模态的内容,并应通过另一个ajax输出来解决问题。

将提高投票率,但我的声誉还没有提高。我在IE8中的模式窗口在成功提交表单时未关闭的情况下使用了此选项。我需要在重定向之前添加这个

$commands[] = ctools_ajax_command_reload()     
$commands[] = ctools_ajax_command_redirect($path, 0, $options);
这正是我需要的。谢谢