feat(17-03): register the journal-post menu item type
- Plugin implements pact.HasMenuItemTypes with a lazy app accessor - journal-post: references by title, resolve fills the layered pattern by ordered replacement (id, slug, category, year, month, day) and builds the ordered per-locale alternates with translated slugs (x-default without enabled locales) - menuitem.journal_post labels in en and pl - TestMenuItemTypesSmoke: host override, item override, sort_order alternates
This commit is contained in:
22
menu_item_types.go
Normal file
22
menu_item_types.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package journal
|
||||
|
||||
import (
|
||||
"git.golem15.com/golem15/sm-journal-plugin/classes"
|
||||
"git.golem15.com/golem15/summercms/modules/backpack"
|
||||
"git.golem15.com/golem15/summercms/modules/pact"
|
||||
)
|
||||
|
||||
// MenuItemTypes registers the Journal menu item types under their PHP keys
|
||||
// (classes.MenuItemTypes) with a lazy accessor of the booted app, so menus
|
||||
// and sitemaps can address Journal posts and categories through the
|
||||
// framework's menu item type registry.
|
||||
func (p *Plugin) MenuItemTypes() []pact.MenuItemType {
|
||||
return classes.MenuItemTypes(func() *backpack.App {
|
||||
if p == nil {
|
||||
return nil
|
||||
}
|
||||
return p.app
|
||||
})
|
||||
}
|
||||
|
||||
var _ pact.HasMenuItemTypes = (*Plugin)(nil)
|
||||
Reference in New Issue
Block a user