Silverstripe HTML阻止“表单行动”

时间:2016-09-16 01:01:57

标签: php silverstripe

一直在寻找离开以实现“HTMLBlock”:

/**
 * @see \HTMLBlock
 */
$fields = array(
    TextField::create('myTextfield', 'My Text Field Label'),
    HTMLBlock::create('<div>Hey I put a HTML block between real fields'),
    TextField::create('myTextfield2', 'My Second Text Field Label')
)

任何人都能提供如何实现这一目标的指针吗?

1 个答案:

答案 0 :(得分:3)

我们可以使用LiteralField将html插入到这样的表单中:

$fields = array(
    TextField::create('myTextfield', 'My Text Field Label'),
    LiteralField::create('myLiteralField1', '<b>some bold text</b> and <a href="http://silverstripe.com">a link</a>'),
    TextField::create('myTextfield2', 'My Second Text Field Label')
);