fromholdio / silverstripe-no-edit-message
在用户没有编辑权限的页面上,在CMS中显示友好的消息,而不是只读表单。
1.0.0
2024-07-23 04:11 UTC
Requires
- silverstripe/cms: ^5.0
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时适用)。