cmsboot

package
v0.21.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BootstrapMenu

func BootstrapMenu(ctx context.Context, svc CMSMenuService, code string) error

BootstrapMenu ensures a menu exists for a given code.

Types

type CMSBlock

type CMSBlock struct {
	ID             string
	DefinitionID   string
	ContentID      string
	Region         string
	Locale         string
	Status         string
	Data           map[string]any
	Position       int
	BlockType      string
	BlockSchemaKey string
}

CMSBlock represents a block instance attached to content/pages.

type CMSBlockDefinition

type CMSBlockDefinition struct {
	ID     string
	Name   string
	Type   string
	Schema map[string]any
	Locale string
}

CMSBlockDefinition describes a reusable block schema.

type CMSContainer

type CMSContainer interface {
	WidgetService() CMSWidgetService
	MenuService() CMSMenuService
	ContentService() CMSContentService
}

CMSContainer abstracts CMS services used by admin.

type CMSContent

type CMSContent struct {
	ID          string
	Title       string
	Slug        string
	Locale      string
	ContentType string
	Status      string
	Blocks      []string
	Data        map[string]any
}

CMSContent represents structured content managed by the CMS.

type CMSContentService

type CMSContentService interface {
	Pages(ctx context.Context, locale string) ([]CMSPage, error)
	Page(ctx context.Context, id, locale string) (*CMSPage, error)
	CreatePage(ctx context.Context, page CMSPage) (*CMSPage, error)
	UpdatePage(ctx context.Context, page CMSPage) (*CMSPage, error)
	DeletePage(ctx context.Context, id string) error
	Contents(ctx context.Context, locale string) ([]CMSContent, error)
	Content(ctx context.Context, id, locale string) (*CMSContent, error)
	CreateContent(ctx context.Context, content CMSContent) (*CMSContent, error)
	UpdateContent(ctx context.Context, content CMSContent) (*CMSContent, error)
	DeleteContent(ctx context.Context, id string) error
	BlockDefinitions(ctx context.Context) ([]CMSBlockDefinition, error)
	CreateBlockDefinition(ctx context.Context, def CMSBlockDefinition) (*CMSBlockDefinition, error)
	UpdateBlockDefinition(ctx context.Context, def CMSBlockDefinition) (*CMSBlockDefinition, error)
	DeleteBlockDefinition(ctx context.Context, id string) error
	BlocksForContent(ctx context.Context, contentID, locale string) ([]CMSBlock, error)
	SaveBlock(ctx context.Context, block CMSBlock) (*CMSBlock, error)
	DeleteBlock(ctx context.Context, id string) error
}

CMSContentService manages pages/blocks backed by the CMS.

type CMSMenuService

type CMSMenuService interface {
	CreateMenu(ctx context.Context, code string) (*Menu, error)
	AddMenuItem(ctx context.Context, menuCode string, item MenuItem) error
	UpdateMenuItem(ctx context.Context, menuCode string, item MenuItem) error
	DeleteMenuItem(ctx context.Context, menuCode, id string) error
	ReorderMenu(ctx context.Context, menuCode string, orderedIDs []string) error
	Menu(ctx context.Context, code, locale string) (*Menu, error)
}

CMSMenuService manages CMS-backed menus.

type CMSPage

type CMSPage struct {
	ID         string
	Title      string
	Slug       string
	TemplateID string
	Locale     string
	ParentID   string
	Blocks     []string
	SEO        map[string]any
	Status     string
	Data       map[string]any
	PreviewURL string
}

CMSPage represents a page managed by the CMS.

type CMSWidgetService

type CMSWidgetService interface {
	RegisterAreaDefinition(ctx context.Context, def WidgetAreaDefinition) error
	RegisterDefinition(ctx context.Context, def WidgetDefinition) error
	DeleteDefinition(ctx context.Context, code string) error
	Areas() []WidgetAreaDefinition
	Definitions() []WidgetDefinition
	SaveInstance(ctx context.Context, instance WidgetInstance) (*WidgetInstance, error)
	DeleteInstance(ctx context.Context, id string) error
	ListInstances(ctx context.Context, filter WidgetInstanceFilter) ([]WidgetInstance, error)
}

CMSWidgetService registers dashboard widget areas/definitions.

type EnsureOptions

type EnsureOptions struct {
	Container         CMSContainer
	WidgetService     CMSWidgetService
	MenuService       CMSMenuService
	ContentService    CMSContentService
	RequireCMS        bool
	BuildContainer    func(context.Context) (CMSContainer, error)
	FallbackContainer func() CMSContainer
}

EnsureOptions configure CMS container resolution.

type EnsureResult

type EnsureResult struct {
	Container      CMSContainer
	WidgetService  CMSWidgetService
	MenuService    CMSMenuService
	ContentService CMSContentService
}

EnsureResult returns resolved CMS container/services.

func Ensure

func Ensure(ctx context.Context, opts EnsureOptions) (EnsureResult, error)

Ensure resolves a CMS container and required services, using builders or fallbacks when enabled.

type GoCMSMenuProvider

type GoCMSMenuProvider interface {
	GoCMSMenuService() any
}

GoCMSMenuProvider exposes a raw go-cms menu service for adapter wiring.

type Menu = navinternal.Menu

Menu represents a simple CMS menu tree.

type MenuItem = navinternal.MenuItem

MenuItem describes a single navigation node.

type WidgetAreaDefinition

type WidgetAreaDefinition = dashinternal.WidgetAreaDefinition

WidgetAreaDefinition captures CMS widget area metadata.

type WidgetDefinition

type WidgetDefinition = dashinternal.WidgetDefinition

WidgetDefinition captures admin widget metadata.

type WidgetInstance

type WidgetInstance = dashinternal.WidgetInstance

WidgetInstance links a widget definition to a specific area/page.

type WidgetInstanceFilter

type WidgetInstanceFilter = dashinternal.WidgetInstanceFilter

WidgetInstanceFilter narrows widget instance queries.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL