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
- Variables
- func Driver(env InstallEnv) dialect.Driver
- func EnableTextFilter(ctx context.Context, env InstallEnv, name string) error
- func EnsureImageStyle(ctx context.Context, env InstallEnv, st ImageStyle) error
- func FullAccessRoles(ctx context.Context, env InstallEnv) ([]string, error)
- func GrantPermission(ctx context.Context, env InstallEnv, role, perm string) error
- func PlaceModuleBlocks(ctx context.Context, env InstallEnv, module string) error
- func Register(m Module, steps func())
- func RegisterInstall(set string, run func(ctx context.Context, env InstallEnv) error)
- func RegisterSchema(set string, s Schema)
- func RegisterUpdate(set string, u Update)
- type AdminMenuItem
- type CommentMode
- type ContentType
- type Dialect
- type ImageStyle
- type InstallEnv
- type Module
- type ModuleCaptchaForm
- type ModuleData
- type ModuleFileSource
- type ModuleLabelColumn
- type ModuleMenuItem
- type ModuleNodeFiles
- type ModuleNodeType
- type ModulePermission
- type ModulePluginBlock
- type PluginBlockID
- type Schema
- type Update
Constants ¶
const ( CommentModeOpen = entity.CommentModeOpen CommentModeClosed = entity.CommentModeClosed CommentModeHidden = entity.CommentModeHidden )
The comment modes (a demo node's, a content type's default).
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").
const BlockVisibilityHomepage = entity.BlockVisibilityHomepage
BlockVisibilityHomepage - a block placement shown on the front page only.
const DialectPostgres = sqldialect.Postgres
DialectPostgres - InstallEnv.Dialect of a PostgreSQL site (else MySQL).
const PluginBlockTargetKey = entity.PluginBlockTargetKey
PluginBlockTargetKey - the plugin config key of the thing a block shows.
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 ¶
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 FullAccessRoles ¶
func FullAccessRoles(ctx context.Context, env InstallEnv) ([]string, error)
FullAccessRoles - the names of the roles with full access (on a usual site, the administrator's), by name: an install step names them where its settings give something to roles, so what only they may do shows in the settings as theirs.
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 ¶
RegisterSchema registers the module's own schema for its set (its manifest's RegisterSteps): its tables and migrations are those.
func RegisterUpdate ¶
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 ¶
ImageStyle - an image style a module's pages use (its install step makes it, EnsureImageStyle).
type InstallEnv ¶
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 ¶
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 Schema ¶
type Schema = migrations.Schema
Schema - the module's own ent schema (its ent/, the conventions in modulekit/schemakit): its tables and migration files.