- 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
23 lines
656 B
Go
23 lines
656 B
Go
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)
|