【发布时间】:2017-12-29 23:51:27
【问题描述】:
我尝试过: removeFieldFromTab removeByName 替换字段
但该字段仍然存在。
use SilverStripe\ORM\DataObject;
use //.....
class Product extends DataObject {
private static $db = [
'ProductName'=>'Varchar',
'TagLine'=>'Text',
'GeneralDescription'=>'HTMLText'
];
private static $has_one = [
'SplashImage'=>Image::Class,
'ProductCategory'=>ProductCategory::Class
];
private static $has_many = [
'ProductImage'=>Image::Class,
'Features'=>'Feature'
];
private static $owns = [
'SplashImage',
'ProductImage'
];
private static $summary_fields = array(
'ProductName'=>'Product Name'
);
private static $searchable_fields = [
];
public function getCMSFields(){
$fields = parent::getCMSFields();
$categoryField = DropdownField::create('ProductCategory', 'Choose Product Category', ProductCategory::get()->map('ID', 'ProductCategoryTitle'));
$fields->replaceField('ProductCategory', $categoryField);
return $fields;
}
}
我没有收到任何错误,但具有 id #'s 的默认下拉字段位于顶部。
【问题讨论】:
-
对于重新排序,您可以使用changeFieldOrder。
-
我不需要重新订购。我需要删除默认字段并使用我自己的。
标签: silverstripe silverstripe-4