Documentation

ModuleInterface

Interface for SproutCMS modules.

Tags
see
Module

Table of Contents

Methods

getName()  : string
Get the name of this module.
getPath()  : string
Get the absolute path of this module.
getVersion()  : string
Get the version of this module.
loadAdmin()  : void
Execute admin setup.
loadSprout()  : void
Execute initial setup.

Methods

getName()

Get the name of this module.

public static getName() : string

This is used to identify the module everywhere.

  • view prefixes: `modules/{name}
  • assets: modules/{name}/path/to/file.css Media::url()
  • needs: Needs:fileGroup($name)
Return values
string

getPath()

Get the absolute path of this module.

public getPath() : string

You can expect these files to be in this directory:

  • db_struct.xml
  • media/
  • views/

Classic modules will also have:

  • sprout_load.php
  • admin_load.php
Return values
string

getVersion()

Get the version of this module.

public getVersion() : string

This is typically the composer package tag + commit hash but there's no requirement for any particular format.

In-built (classic) modules can use the ModuleSiteTrait to use the root package version.

Return values
string

loadAdmin()

Execute admin setup.

public loadAdmin() : void

These are loaded while constructing admin controllers.

This will not be executed more than once.

loadSprout()

Execute initial setup.

public loadSprout() : void

This is loaded AFTER routing but BEFORE any controllers are created.

This will not be executed more than once.

On this page

Search results