silverstripe-4 - 从页面中删除默认 HtmlEditorField
问题描述
有没有办法从 SilverStripe 4.2.2 的后端页面中删除/禁用默认的 HtmlEditorField(内容)?
解决方案
从您的页面或页面的子类:
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('Root.Main.Content');
return $fields;
}
或作为扩展:
class RemoveContentExtension extends \SilverStripe\ORM\DataExtension
{
public function updateCMSFields(\SilverStripe\Forms\FieldList $fields)
{
$fields->removeByName('Root.Main.Content');
}
}
并使用 YAML 配置将扩展应用到您的页面:
# File: app/_config/content.yml
MyPage:
extensions:
- RemoveContentExtension
推荐阅读
- php - Laravel 5.8 通知独立目标 [Illuminate\Contracts\Notifications\Dispatcher] 不可实例化
- java - 在运行时修改 jarfile
- javascript - 在 React Native 中为 SVG 设置高度时宽度不会改变
- sql - 返回过去 12 个月内没有活动但当月有活动的所有行?
- javascript - 打字稿:将类型定义为具有部分存在对象的类型的联合
- firebase - 如何根据 Flutter 中的订阅向用户发送 Firebase 推送通知?
- swiftui - 如何通过另一个可观察的 0bject 观察已发布的属性 - Swift Combine
- javascript - 如何将对象时间戳转换为 Firebase 时间戳?
- css - 允许自定义 CSS 的危险
- javascript - 添加数据表分页