fromholdio/silverstripe-no-edit-message

在用户没有编辑权限的页面上,在CMS中显示友好的消息,而不是只读表单。

安装: 9

依赖者: 0

建议者: 0

安全: 0

星标: 1

关注者: 2

分支: 0

开放问题: 0

类型:silverstripe-vendormodule

1.0.0 2024-07-23 04:11 UTC

This package is auto-updated.

Last update: 2024-09-23 04:39:24 UTC


README

在用户没有编辑权限的页面上,在CMS中显示友好的消息,而不是只读表单。

包括替换页面历史界面并显示消息。

要实施

Page:
  is_no_edit_message_enabled: true    # default: true

以下必须添加到您的Page

public function getCMSFields()
{
    if ($this->doShowNoEditMessage() && Controller::curr() instanceof LeftAndMain) {
        return $this->getNoEditCMSFields();
    }
    
    # ... any other regular code.
}

public function getSettingsFields()
{
    if ($this->doShowNoEditMessage() && Controller::curr() instanceof LeftAndMain) {
        return $this->getNoEditCMSFields();
    }
    
    # ... any other regular code.
}

已设置钩子来修改消息、标签路径和字段,甚至何时显示此消息的触发器(默认情况下,当canEdit为false时适用)。