从页面中删除默认的HtmlEditorField

时间:2018-11-28 17:16:48

标签: silverstripe-4 form-fields

是否可以从SilverStripe 4.2.2的后端的页面中删除/禁用默认的HtmlEditorField(内容)?

1 个答案:

答案 0 :(得分:1)

在您的Page或Page的子类中:

ssh-keygen

或作为扩展名:

public function getCMSFields()
{
    $fields = parent::getCMSFields();

    $fields->removeByName('Root.Main.Content');

    return $fields;
}

并使用YAML配置将扩展名应用于您的页面:

class RemoveContentExtension extends \SilverStripe\ORM\DataExtension
{
    public function updateCMSFields(\SilverStripe\Forms\FieldList $fields)
    {
        $fields->removeByName('Root.Main.Content');
    }
}
相关问题