SilverStripe Fluent 字段图标
SilverStripe Fluent field icons
在后端,SilverStripe Fluent 模块添加了一个绿色标志图标以指示该字段是可翻译的(如 PageName、URL 段和内容旁边所示)。
这是一个用户友好的细节,我希望它适用于可翻译的自定义添加的 CMS 字段。例如,我添加了一个名为 Introduction
的自定义字段,并使用以下命令使其可翻译: private static $translate = array( 'Introduction' );
但是它旁边没有绿色图标。 这个可以加吗?
有必要在 $fields = parent::getCMSFields();
之前添加 $this->beforeUpdateCMSFields(function($fields) { ... }
并将所有可翻译字段放在那里:
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;
}
在后端,SilverStripe Fluent 模块添加了一个绿色标志图标以指示该字段是可翻译的(如 PageName、URL 段和内容旁边所示)。
这是一个用户友好的细节,我希望它适用于可翻译的自定义添加的 CMS 字段。例如,我添加了一个名为 Introduction
的自定义字段,并使用以下命令使其可翻译: private static $translate = array( 'Introduction' );
但是它旁边没有绿色图标。 这个可以加吗?
有必要在 $fields = parent::getCMSFields();
之前添加 $this->beforeUpdateCMSFields(function($fields) { ... }
并将所有可翻译字段放在那里:
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;
}