manifestkit

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package manifestkit - the part of the module SDK (modulekit) a module's manifest and own ent schema use: the module's description and its schema's registration. Light on purpose - it imports the core's entities and migrations only - so the manifests stay importable from the core's own tests (they register the modules), where the rest of modulekit, built on the core's services, would be an import cycle.

Index

Constants

View Source
const (
	CommentModeOpen   = entity.CommentModeOpen
	CommentModeClosed = entity.CommentModeClosed
	CommentModeHidden = entity.CommentModeHidden
)

The comment modes (a demo node's, a content type's default).

View Source
const (
	CategoryContent        = entity.ModuleCategoryContent
	CategoryMedia          = entity.ModuleCategoryMedia
	CategoryCommunity      = entity.ModuleCategoryCommunity
	CategoryAdministration = entity.ModuleCategoryAdministration
	CategoryIntegrations   = entity.ModuleCategoryIntegrations
	CategoryOther          = entity.ModuleCategoryOther
)

The groups of the Modules page a module picks for its Category (Module .Category; none or another - "Other").

View Source
const BlockVisibilityHomepage = entity.BlockVisibilityHomepage

BlockVisibilityHomepage - a block placement shown on the front page only.

View Source
const DialectPostgres = sqldialect.Postgres

DialectPostgres - InstallEnv.Dialect of a PostgreSQL site (else MySQL).

View Source
const PluginBlockTargetKey = entity.PluginBlockTargetKey

PluginBlockTargetKey - the plugin config key of the thing a block shows.

View Source
const RoleUser = entity.RoleUser

RoleUser - the role every signed-in user has (a module's install or data step grants it the module's permissions).

Variables

View Source
var (
	AdminSectionContent       = entity.AdminSectionContent
	AdminSectionStructure     = entity.AdminSectionStructure
	AdminSectionConfiguration = entity.AdminSectionConfiguration
	AdminSectionReports       = entity.AdminSectionReports
	AdminGroupModules         = entity.AdminGroupModules
	AdminGroupTexts           = entity.AdminGroupTexts
	AdminGroupSite            = entity.AdminGroupSite
)

The admin toolbar's sections a module's page joins (ModuleMenuItem's Section); AdminGroupModules - the Configuration section's group of the modules' settings pages, AdminGroupTexts - of the texts' and files', AdminGroupSite - of the site's own (AdminMenuItem.Group: the item goes after its group's last one).

Functions

func Driver

func Driver(env InstallEnv) dialect.Driver

Driver - the step's database as an ent driver, for the module's own client (its generated NewClient(Driver(…))).

func EnableTextFilter

func EnableTextFilter(ctx context.Context, env InstallEnv, name string) error

EnableTextFilter turns the module's text filter name (modulekit.AddTextFilter) on for the text formats with the visual editor - its install step: the formats a site writes in with links and pictures. A format with it on already is left as it is. (A running site reads the formats' filters again after installing a module.)

func EnsureImageStyle

func EnsureImageStyle(ctx context.Context, env InstallEnv, st ImageStyle) error

EnsureImageStyle makes the core's image style st unless one of its name is there (kept by an uninstall, or made by the site): left as it is then.

func GrantPermission

func GrantPermission(ctx context.Context, env InstallEnv, role, perm string) error

GrantPermission gives the role named role (RoleUser - every signed-in user's) the permission perm, keeping its others - an install step's default of who may use the module. A site without the role - nothing.

func PlaceModuleBlocks

func PlaceModuleBlocks(ctx context.Context, env InstallEnv, module string) error

PlaceModuleBlocks places the module's plugin blocks that name a region (ModulePluginBlock.Region) in the site's active theme, as installing it does: a data step for sites that had the module before the block.

func Register

func Register(m Module, steps func())

Register records a module from outside the engine: modulekit.Register calls it from the module's init, before the engine reads its modules (manifests.Register adds them after its own); steps - the module's RegisterSteps (its schema, install, update and demo steps), nil - none.

func RegisterInstall

func RegisterInstall(set string, run func(ctx context.Context, env InstallEnv) error)

RegisterInstall sets the module's install step: it runs once, when the module is installed, after its tables are created (its RegisterSteps).

func RegisterSchema

func RegisterSchema(set string, s Schema)

RegisterSchema registers the module's own schema for its set (its manifest's RegisterSteps): its tables and migrations are those.

func RegisterUpdate

func RegisterUpdate(set string, u Update)

RegisterUpdate adds a data step of the module (its RegisterSteps).

Types

type AdminMenuItem

type AdminMenuItem = entity.AdminMenuItem

AdminMenuItem - an admin toolbar item.

type CommentMode

type CommentMode = entity.CommentMode

CommentMode - a material's comments: open, closed, hidden.

type ContentType

type ContentType = entity.ContentType

ContentType - a content type's machine name.

type Dialect

type Dialect = sqldialect.Dialect

Dialect - a site's database (DialectPostgres, else MySQL): its Rebind puts a query's ? placeholders in the database's own.

type ImageStyle

type ImageStyle struct {
	Name, Label, Mode, Anchor string
	Width, Height             int
}

ImageStyle - an image style a module's pages use (its install step makes it, EnsureImageStyle).

type InstallEnv

type InstallEnv struct {
	DB      *sql.DB
	Dialect Dialect
}

InstallEnv - what a module's install or data step works with: the database (DB, Dialect) - its own client opens a driver on it (Driver); the core's rows it changes through this package's helpers.

type Module

type Module = entity.Module

Module - a module's registry entry.

func Registered

func Registered() ([]Module, []func())

Registered - the modules from outside the engine and their steps.

type ModuleCaptchaForm

type ModuleCaptchaForm = entity.ModuleCaptchaForm

ModuleCaptchaForm - its form that can show the CAPTCHA.

type ModuleData

type ModuleData = entity.ModuleData

ModuleData - a table of the module's that the Modules page counts.

type ModuleFileSource

type ModuleFileSource = entity.ModuleFileSource

ModuleFileSource - its texts that can link to users' files.

type ModuleLabelColumn

type ModuleLabelColumn = entity.ModuleLabelColumn

ModuleLabelColumn - its install step's labels app install translates.

type ModuleMenuItem

type ModuleMenuItem = entity.ModuleMenuItem

ModuleMenuItem - its page in the admin toolbar.

type ModuleNodeFiles

type ModuleNodeFiles = entity.ModuleNodeFiles

ModuleNodeFiles - its tables of files attached to nodes.

type ModuleNodeType

type ModuleNodeType = entity.ModuleNodeType

ModuleNodeType - a content type it provides.

type ModulePermission

type ModulePermission = entity.ModulePermission

ModulePermission - a permission it adds.

type ModulePluginBlock

type ModulePluginBlock = entity.ModulePluginBlock

ModulePluginBlock - a plugin block it provides.

type PluginBlockID

type PluginBlockID = entity.PluginBlockID

PluginBlockID - a plugin block's id.

type Schema

type Schema = migrations.Schema

Schema - the module's own ent schema (its ent/, the conventions in modulekit/schemakit): its tables and migration files.

type Update

type Update struct {
	Version     string
	Description string
	Run         func(ctx context.Context, env InstallEnv) error
}

Update - a module's data step: Go code moving or fixing its data, at its Version among its migration files (a timestamp).

Jump to

Keyboard shortcuts

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