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:
2026-10-12 16:53:09 +02:00
parent 58851dd101
commit fd1572a3a2
5 changed files with 615 additions and 0 deletions

22
menu_item_types.go Normal file
View 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)