【问题标题】:In the SilverStripe backend, is there a way to render a column with a template?在 SilverStripe 后端,有没有办法用模板呈现列?
【发布时间】:2020-04-21 23:51:43
【问题描述】:

我在我的数据对象中定义了 $summary_fields,我想将一列(“标签”)呈现为芯片列表(al la Material UI),但我想避免将任何 HTML 添加到我的数据对象类中。我希望我可以简单地做一些类似的事情(为简洁起见):

$template = new Template('my_column_template_name');
return $template->render($this->Tags());

这在 SilverStripe 中是否可行?

【问题讨论】:

    标签: silverstripe


    【解决方案1】:

    原来很简单:

    $this->owner->renderWith('Admin/Models/Member/tags-column');
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-07-20
      • 2018-08-14
      • 2020-03-07
      • 1970-01-01
      • 1970-01-01
      • 2021-06-16
      • 2021-12-22
      • 2010-12-01
      相关资源
      最近更新 更多