1

我有 CiviCRM 4.4.6 + Drupal 7,并且我更改了 CiviCRM 的一种形式。

在里面hook_civicrm_buildForm(),我尝试:

form->addElement('html', 'statichtml', '<div>aa</div>');
$template =& CRM_Core_Smarty::singleton();
$bhfe = $template->get_template_vars('beginHookFormElements');
if (!$bhfe) {
  $bhfe = array();
}
$bhfe[] = 'statichtml';
$form->assign('beginHookFormElements', $bhfe);

如果我将它与“文本”元素类型一起使用,它可以正常工作。这种方式不会渲染任何内容,但会添加一个空tr的附加项。如何正确使用此类元素?

4

1 回答 1

1

http://pear.php.net/manual/hu/package.html.html-quickform.intro-elements.php 这里是解释。元素类型应该是static, nothtml并且上面的代码开始工作。

于 2014-08-01T12:37:32.280 回答