【问题标题】:How to add static html markup to a CiviCRM form如何将静态 html 标记添加到 CiviCRM 表单
【发布时间】:2014-07-31 15:43:44
【问题描述】:

我有 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。 如何正确使用这类元素?

【问题讨论】:

    标签: php civicrm quickform


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-14
      • 1970-01-01
      • 2011-01-04
      • 1970-01-01
      • 2016-12-19
      • 2020-05-14
      相关资源
      最近更新 更多