SilverStripe Fluent 字段图标

Fal*_*ude 3 php silverstripe

在后端,SilverStripe Fluent 模块添加了一个绿色旗帜图标来指示该字段是可翻译的(如页面名称、URL 段和内容旁边所示)。

这是一个用户友好的细节,我希望它适用于自定义添加的可翻译的 CMS 字段。例如,我添加了一个名为的自定义字段Introduction并使其可翻译:private static $translate = array( 'Introduction' );但旁边没有绿色图标。这个可以加吗?

图片旁边没有绿色图标

Fal*_*ude 5

有必要添加$this->beforeUpdateCMSFields(function($fields) { ... }BEFORE$fields = parent::getCMSFields();并将所有可翻译字段放入其中,如下所示:

function getCMSFields() {

    //This needs to be added for Fluent to apply css
    $this->beforeUpdateCMSFields(function($fields) {
        //Translatable field
        $fields->addFieldToTab("Root.Main", new TextAreaField('Introduction','Introduction'), 'Content');
    });

    $fields = parent::getCMSFields();

    //Non-translatable field
    $fields->addFieldToTab("Root.Main", $uploadField = new UploadField('Slideshow', 'Slideshow Images'), 'Content');

    return $fields;
}
Run Code Online (Sandbox Code Playgroud)