Loads and manages all modules in ProcessWire.
The $modules
API variable is most commonly used for getting individual modules to use their API.
// Getting a module by name
$m = $modules->get('MarkupPagerNav');
// Getting a module by name (alternate)
$m = $modules->MarkupPagerNav;
Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the Modules
class also inherits all the methods and properties of: WireArray and Wire.
Common
Manipulation
Name | Return | Summary | |
---|---|---|---|
$modules->delete() $modules->delete(string $class) $modules->delete(string $class) | bool | Delete the given module, physically removing its files | |
$modules->install() $modules->install(string $class) $modules->install(string $class, $options = []) | null Module | Install the given module name | |
$modules->refresh() $modules->refresh() $modules->refresh(bool $showMessages = false) | (nothing) | Refresh the modules cache | |
$modules->saveConfig() $modules->saveConfig($class, $data) $modules->saveConfig($class, $data, $value = null) | bool | Save provided configuration data for the given module | |
$modules->uninstall() $modules->uninstall(string $class) $modules->uninstall(string $class) | bool | Uninstall the given module name |
Configuration
Name | Return | Summary | |
---|---|---|---|
$modules->getConfig() $modules->getConfig($class) $modules->getConfig($class, string $property = '') | array string int float | Given a module name, return an associative array of configuration data for it | |
$modules->getModuleEditUrl() $modules->getModuleEditUrl($className) $modules->getModuleEditUrl($className, bool $collapseInfo = true) | string | Return the URL where the module can be edited, configured or uninstalled | |
$modules->getModuleInstallUrl() $modules->getModuleInstallUrl(string $className) $modules->getModuleInstallUrl(string $className) | string | Get URL where an administrator can install given module name | |
$modules->isConfigurable() $modules->isConfigurable($class) $modules->isConfigurable($class, bool $useCache = true) | bool string int | Is the given module interactively configurable? | |
$modules->saveConfig() $modules->saveConfig($class, $data) $modules->saveConfig($class, $data, $value = null) | bool | Save provided configuration data for the given module |
Additional methods and properties
In addition to the methods and properties above, Modules also inherits the methods and properties of these classes:
API reference based on ProcessWire core version 3.0.236