我正在尝试修改gallery3的注册模块。我在表单中添加了一个新元素(由Forge生成),但是想要添加一个指向相关标签的超链接。不幸的是,它被脚本转义,即使是html :: mark_clean()也无济于事。
这是我的代码:
$form = new Forge("register/handler", "", "post", array("id" => "g-register-form"));
$group = $form->group("register_user")->label(t("Register user"));
$group->checkbox("accept_terms")->label(html::mark_clean(t(html::mark_clean('I confirm to have read the <a href="%url">terms of usage</a>.'),
array("url" => html::mark_clean("http://www.google.de")))))
->id("g-accept-terms")
->rules("required")
->error_messages("accept", t("You have to accept the terms of usage before you may register."));
正如您所看到的,我已将mark_clean添加到不同位置以进行测试。
结果如下:
<label>
<input type="checkbox" class="checkbox" value="1" name="accept_terms" id="g-accept-terms">
I confirm to have read the <a href="http://www.google.de">terms of usage</a>.
</label>
我想避免更改任何现有的核心文件。 谢谢你的帮助!
答案 0 :(得分:0)
$group->checkbox("accept_terms")->label(t('I confirm to have read the <a href="http://yourURL.com/" target="_blank">terms of usage</a>. more text'))
->rules("required")
->error_messages("accept", t("You have to accept the terms of usage before you may register."));