Documentation
¶
Overview ¶
Package posttype is the kernel's content-type discovery index. Modules declare the types they provide via kernel.ContentTypeProvider; core collects the declarations into this registry after InitAll. It answers only "which types exist and which slugs are reserved" — rich definitions (fields, validation, templates) stay in module domains.
Index ¶
- Variables
- type Registry
- func (r *Registry) All() []kernel.PostTypeDef
- func (r *Registry) CollectFrom(reg *kernel.Registry) error
- func (r *Registry) GetBySlug(slug string) (kernel.PostTypeDef, bool)
- func (r *Registry) IsProtected(slug string) bool
- func (r *Registry) Register(def kernel.PostTypeDef) error
- func (r *Registry) Slugs() []string
Constants ¶
This section is empty.
Variables ¶
var ( ErrDuplicatePostType = errors.New("kernel: duplicate post type") ErrEmptyPostTypeSlug = errors.New("kernel: post type slug cannot be empty") )
Functions ¶
This section is empty.
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is the process-wide index of content types. Register order never matters; All returns slugs sorted. Protected slugs (claimed by built-in modules) are recorded so later phases can refuse overrides.
func (*Registry) All ¶
func (r *Registry) All() []kernel.PostTypeDef
All returns every registered definition in slug-sorted order.
func (*Registry) CollectFrom ¶
CollectFrom gathers every ContentTypeProvider in the module registry into r, in module-name order. The first duplicate slug aborts the collection.
func (*Registry) GetBySlug ¶
func (r *Registry) GetBySlug(slug string) (kernel.PostTypeDef, bool)
GetBySlug returns the definition registered under slug.
func (*Registry) IsProtected ¶
IsProtected reports whether the slug was claimed as protected by a module.