Get a module, get module information, and much more ($modules API variable as a function)

This function behaves the same as the $modules API variable, though does support an optional shortcut argument for getting a module.

Example

$modules = modules(); // Simply get $modules API var
$module = modules()->get('ModuleName'); // Get a module
$module = modules('ModuleName'); // Shortcut to get a module

Usage

// basic usage
$modules = modules();

// usage with all arguments
$modules = modules(string $name = '');

Arguments

NameType(s)Description
name (optional)string

Optionally retrieve the given module name

Return value

Modules Module ConfigurableModule null


Functions methods and properties

API reference based on ProcessWire core version 3.0.148

Twitter updates

  • This week we’ve got a couple of really useful API-side improvements to the core in 3.0.151, including predefined image settings and static language translation improvements— More
    21 February 2020
  • New post in the blog about all the fun we had driving around a DDOS attack on our forums, how we got it back under control, and what we learned along the way. Plus PW 3.0.150 dev details and links! More
    7 February 2020
  • New post: ProcessWire core updates (January 31, 2020)— More
    31 January 2020

Latest news

  • ProcessWire Weekly #301
    In the 301st issue of ProcessWire Weekly we're going to check out the latest core updates, introduce brand new third party modules RockDaterange and Modules Manager 2, and highlight a brilliant new site of the week. Read on!
    Weekly.pw / 15 February 2020
  • ProcessWire 3.0.151 core updates
    Blog / 21 February 2020
  • Subscribe to weekly ProcessWire news

“Indeed, if ProcessWire can be considered as a CMS in its own right, it also offers all the advantages of a CMF (Content Management Framework). Unlike other solutions, the programmer is not forced to follow the proposed model and can integrate his/her ways of doing things.” —Guy Verville, Spiria Digital Inc.