pact.SettingsItem gains an additive Controller field, the equivalent of a WinterCMS registerSettings 'url' => Backend::url(...) entry. A link entry declares no Model, Form or NewModel and needs no AdminFS; start-up fails when it combines Controller with a singleton form or a model, or names an unregistered controller. Settings codes stay one namespace. GET /settings lists a link entry with its controller only when the principal passes the item's permissions and may open the controller. Registry.Setting never returns a link entry, so the singleton settings endpoints answer 404 for its code. SettingsEntry carries controller, empty for singletons; the OpenAPI document, generated SPA types and settings fixture follow, and the pact and cabana READMEs and the settings docs describe the link.
25 lines
789 B
Go
25 lines
789 B
Go
package cabana_test
|
|
|
|
import "git.golem15.com/golem15/summercms/modules/pact"
|
|
|
|
// LinkedBlogPlugin adds a settings entry that opens the posts controller from
|
|
// the Settings page.
|
|
type LinkedBlogPlugin struct{ BlogPlugin }
|
|
|
|
// Settings keeps the singleton page and adds a controller link.
|
|
func (p *LinkedBlogPlugin) Settings() []pact.SettingsItem {
|
|
// docs:start settings-link
|
|
link := pact.SettingsItem{
|
|
Code: "posts",
|
|
Label: "acme.blog::lang.posts.title",
|
|
Description: "acme.blog::lang.posts.description",
|
|
Category: "acme.blog::lang.plugin.name",
|
|
Icon: "icon-pencil",
|
|
Order: 500,
|
|
Permissions: []string{"acme.blog.access_settings"},
|
|
Controller: "acme.blog.posts",
|
|
}
|
|
// docs:end settings-link
|
|
return append(p.BlogPlugin.Settings(), link)
|
|
}
|