在Silverstripe的SiteTree中更改内容的字段类型

时间:2014-06-30 09:52:42

标签: silverstripe

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

我似乎无法覆盖它:

class ParsedownExtension extends DataExtension {

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

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

1 个答案:

答案 0 :(得分: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

相关问题