一直在寻找离开以实现“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')
)
任何人都能提供如何实现这一目标的指针吗?
答案 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')
);