将3.5站点升级到4.x.我有以下扩展名:
class BrandExtension extends DataExtension {
private static $has_one = array(
"BrandPage" => BrandPage::class
);
public function updateCMSFields(FieldList $fields) {
parent::updateCMSFields($fields);
$mic = new TreeDropdownField("BrandPageID", "Select portfolio page to link to", SiteTree::class);
$fields->addFieldToTab('Root.Main', $mic, 'Content');
}
}
这是命名空间,所以我更新了config.yml包含:
Vendor\Project\MicrositePage:
extensions:
- Vendor\Project\BrandExtension
在开发/构建之后,该字段似乎想要显示,但它只显示标签。
我尝试更改构造函数的格式。 4.0文档表明以上是正确的格式。而改变构造函数并没有做任何事情。
$mic = TreeDropdownField::create("BrandPageID", "Select portfolio page to link to", SiteTree::class);
检查页面显示我正在注入某些东西。
<div class="TreeDropdownField treedropdown single searchable searchable" id="Form_EditForm_BrandPageID" data-schema="{"name":"BrandPageID","id":"Form_EditForm_BrandPageID","type":"text","schemaType":"SingleSelect","component":"TreeDropdownField","holderId":"Form_EditForm_BrandPageID_Holder","title":"Select portfolio page to link to","source":null,"extraClass":"treedropdown single searchable","description":null,"rightTitle":null,"leftTitle":null,"readOnly":false,"disabled":false,"customValidationMessage":"","validation":[],"attributes":[],"autoFocus":false,"data":{"urlTree":"admin\/pages\/edit\/EditForm\/153\/field\/BrandPageID\/tree","showSearch":true,"emptyString":"(Choose Page)","hasEmptyDefault":false,"multiple":false}}" data-state="{"name":"BrandPageID","id":"Form_EditForm_BrandPageID","value":0,"message":null,"data":{"cacheKey":"2018-03-06 03:43:41","showSelectedPath":false}}">
<input id="Form_EditForm_BrandPageID" type="hidden" name="BrandPageID" value="0">
完成多个开发构建。试图冲洗CMS。甚至在/ tmp下删除了SS缓存。对我在这里做错了什么的想法?
答案 0 :(得分:0)
我发现退出CMS并再次返回会导致显示该字段。虽然看起来确实有点敏感。有几次我刷新了我的CMS页面,它已经在加载时消失了。