package menu import ( "embed" "io/fs" "git.golem15.com/golem15/sm-menu-plugin/controllers" "git.golem15.com/golem15/summercms/modules/backpack" "git.golem15.com/golem15/summercms/modules/pact" ) // adminFS holds the admin YAML file by file: the controllers directory also // holds Go sources. // //go:embed controllers/menus/config_form.yaml controllers/menus/config_list.yaml models/menu/fields.yaml models/menu/columns.yaml //go:embed controllers/menuentries/config_form.yaml controllers/menuentries/config_list.yaml controllers/menuentries/config_filter.yaml controllers/menuentries/config_reorder.yaml //go:embed models/menuentry/fields.yaml models/menuentry/columns.yaml var adminFS embed.FS //go:embed lang var langFS embed.FS // AdminFS serves the admin YAML. func (p *Plugin) AdminFS() fs.FS { return adminFS } // LangFS is the embedded English and Polish phrasebooks. func (p *Plugin) LangFS() fs.FS { return langFS } // AdminControllers hands the controllers a lazy accessor of the booted app, // so they read the database and the menu item type registry at request // time. func (p *Plugin) AdminControllers() []pact.AdminController { return controllers.AdminControllers(func() *backpack.App { if p == nil { return nil } return p.app }) } var ( _ pact.AdminAssets = (*Plugin)(nil) _ pact.HasAdminControllers = (*Plugin)(nil) _ pact.HasLang = (*Plugin)(nil) )