Question

I have CiviCRM 4.4.6 + Drupal 7 and i alter one of CiviCRM's forms.

Inside hook_civicrm_buildForm(), i try to:

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

If i use it with 'text' element type, it works correctly. This way nothing is rendered, but an empty additional tr is added. How to use this type of element correctly?

Was it helpful?

Solution

http://pear.php.net/manual/hu/package.html.html-quickform.intro-elements.php Here is the explanation. The element type should be static, not html and the above code starts to work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top