Modules
in package
Manage module registrations.
Use this helper to retrieve information about registered modules.
The register() method is available also as Register::module() for simplicity and backward-compat.
Table of Contents
Properties
- $loaded : array<ModuleInterface>, bool>
- $modules : array<string|int, ModuleInterface>
Methods
- getModule() : null|ModuleInterface
- Get a module by it's name.
- getModuleByClass() : null|ModuleInterface
- Get a module by it's class name.
- getModuleByPath() : null|ModuleInterface
- Find which module this path belongs to.
- getModuleForClass() : null|ModuleInterface
- Find which module this class belongs to.
- getModules() : array<string|int, ModuleInterface>
- Gets the list of active modules
- isInstalled() : bool
- Is this module installed?
- isLoaded() : bool
- Is this module loaded?
- loadModule() : void
- Load a module.
- loadModules() : void
- Load all modules for a given mode.
- register() : ModuleInterface
- Register a module.
Properties
$loaded
private
static array<ModuleInterface>, bool>
$loaded
= []
$modules
private
static array<string|int, ModuleInterface>
$modules
= []
Methods
getModule()
Get a module by it's name.
public
static getModule(string $name) : null|ModuleInterface
Parameters
- $name : string
-
shorthand name
Return values
null|ModuleInterfacegetModuleByClass()
Get a module by it's class name.
public
static getModuleByClass(ModuleInterface> $target) : null|ModuleInterface
Parameters
- $target : ModuleInterface>
Return values
null|ModuleInterfacegetModuleByPath()
Find which module this path belongs to.
public
static getModuleByPath(string $path) : null|ModuleInterface
Parameters
- $path : string
-
a file path, for a class or asset
Return values
null|ModuleInterfacegetModuleForClass()
Find which module this class belongs to.
public
static getModuleForClass(object|string $target) : null|ModuleInterface
Parameters
- $target : object|string
Return values
null|ModuleInterfacegetModules()
Gets the list of active modules
public
static getModules() : array<string|int, ModuleInterface>
Return values
array<string|int, ModuleInterface>isInstalled()
Is this module installed?
public
static isInstalled(string $name) : bool
Parameters
- $name : string
Return values
boolisLoaded()
Is this module loaded?
public
static isLoaded(string $mode, ModuleInterface|ModuleInterface> $module) : bool
Parameters
- $mode : string
- $module : ModuleInterface|ModuleInterface>
Return values
boolloadModule()
Load a module.
public
static loadModule(string $mode, ModuleInterface $module) : void
Parameters
- $mode : string
-
sprout|admin
- $module : ModuleInterface
loadModules()
Load all modules for a given mode.
public
static loadModules(string $mode) : void
Parameters
- $mode : string
register()
Register a module.
public
static register(ModuleInterface> $module) : ModuleInterface
Parameters
- $module : ModuleInterface>
-
class name