$modules->getModuleInfo() method

Returns an associative array of information for a Module

The array returned by this method includes the following:

  • id (int): module database ID.
  • name (string): module class name.
  • title (string): module title.
  • version (int): module version.
  • icon (string): Optional icon name (excluding the "fa-") part.
  • requires (array): module names required by this module.
  • requiresVersions (array): required module versions–module name is key, value is array($operator, $version).
  • installs (array): module names that this module installs.
  • permission (string): permission name required to execute this module.
  • autoload (bool): true if module is autoload, false if not.
  • singular (bool): true if module is singular, false if not.
  • created (int): unix-timestamp of date/time module added to system (for uninstalled modules, it is the file date).
  • installed (bool): is the module currently installed? (boolean, or null when not determined)
  • configurable (bool|int): true or positive number when the module is configurable.
  • namespace (string): PHP namespace that module lives in.

The following properties are also included when "verbose" mode is requested. When not in verbose mode, these properties are present but blank:

  • versionStr (string): formatted module version string.
  • file (string): module filename from PW installation root, or false when it can't be found.
  • core (bool): true when module is a core module, false when not.
  • author (string): module author, when specified.
  • summary (string): summary of what this module does.
  • href (string): URL to module details (when specified).
  • permissions (array): permissions installed by this module, associative array ('permission-name' => 'Description').
  • page (array): definition of page to create for Process module (see Process class)

The following properties appear only for "Process" modules, and only if specified by module. See the Process class for more details:

  • nav (array): navigation definition
  • useNavJSON (bool): whether the Process module provides JSON navigation
  • permissionMethod (string|callable): method to call to determine permission
  • page (array): definition of page to create for Process module

Example

// example of getting module info
$moduleInfo = $modules->getModuleInfo('InputfieldCKEditor');

// example of getting verbose module info
$moduleInfo = $modules->getModuleInfoVerbose('MarkupAdminDataTable');

Usage

// basic usage
$array = $modules->getModuleInfo($class);

// usage with all arguments
$array = $modules->getModuleInfo($class, array $options = []);

Arguments

NameType(s)Description
classstring, Module, int

Specify one of the following:

  • Module object instance
  • Module class name (string)
  • Module ID (int)
  • To get info for ALL modules, specify * or all.
  • To get system information, specify ProcessWire or PHP.
  • To get a blank module info template, specify info.
options (optional)array

Optional options to modify behavior of what gets returned

  • verbose (bool): Makes the info also include verbose properties, which are otherwise blank. (default=false)
  • minify (bool): Remove non-applicable and properties that match defaults? (default=false, or true when getting all)
  • noCache (bool): prevents use of cache to retrieve the module info. (default=false)

Return value

array

Associative array of module information

Exceptions

Method can throw exceptions on error:

  • WireException - when a module exists but has no means of returning module info

See Also


$modules methods and properties

API reference based on ProcessWire core version 3.0.125

Twitter updates

  • New post: This week we take a look at what’s in ProcessWire 3.0.126 which focuses largely on resolving issue reports, but also includes a handy new Page if() method— More
    15 February 2019
  • New post: ProcessWire 3.0.125 has several useful new Sanitizer methods & options, plus new ways to access them directly from the Input API variable. This makes handling user input even easier than before. Plus updates to our i18n functions & API docs— More
    25 January 2019
  • New post: In this week’s post, we’ll take a look a look at the new website and focus on some parts of it and how they were built. Then we’ll dive into the latest version of ProcessWire on the dev branch, version 3.0.124— More
    11 January 2019

Latest news

  • ProcessWire Weekly #249
    In the 249th issue of ProcessWire Weekly we're going to walk you through the latest core updates (ProcessWire 3.0.126), introduce a new third party module called Page Access Releasetime, and pick a new site of the week. Read on!
    Weekly.pw / 16 February 2019
  • ProcessWire 3.0.126 core updates
    This week we take a look at what’s in ProcessWire 3.0.126 which focuses largely on resolving issue reports, but also includes a handy new $page->if() method. 
    Blog / 15 February 2019
  • Subscribe to weekly ProcessWire news

“To Drupal, or to ProcessWire? The million dollar choice. We decided to make an early switch to PW. And in retrospect, ProcessWire was probably the best decision we made. Thanks are due to ProcessWire and the amazing system and set of modules that are in place.” —Unni Krishnan, Founder of PigtailPundits