【问题标题】:Changing the fieldtype of Content in Silverstripe's SiteTree在 Silverstripe 的 SiteTree 中更改内容的字段类型
【发布时间】:2014-06-30 20:21:42
【问题描述】:

是否可以通过扩展更改数据库中Content 的字段类型?

看来我不能像这样覆盖它:

class ParsedownExtension extends DataExtension {

    private static $db = array(
        'Content' => 'ParsedownField'
    );
}

我的字段类型和扩展名确实有效,因为它适用于不同于 Content 的字段名

【问题讨论】:

    标签: silverstripe


    【解决方案1】:

    可以通过在_config.php 文件中设置字段类型来更改它。

    mysite/_config.php

    $fields = Config::inst()->get('SiteTree', 'db', Config::UNINHERITED); 
    $fields['Content'] = 'ParsedownField'; 
    Config::inst()->update('SiteTree', 'db', $fields);
    

    这个答案是在 Silverstripe 论坛上找到的一个问题:
    http://www.silverstripe.org/general-questions/show/23967

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-11
      • 1970-01-01
      • 1970-01-01
      • 2012-09-22
      • 1970-01-01
      相关资源
      最近更新 更多