我有 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
的附加项。如何正确使用此类元素?