Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #3 from bluehost/feature/add-ismoduleactive
Browse files Browse the repository at this point in the history
add isModuleActive method to report active status of specified module
  • Loading branch information
circlecube authored Oct 13, 2021
2 parents d3e6772 + 7923743 commit bbcef0b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions includes/ModuleManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,22 @@ public static function loadActiveModules() {
}
}

/**
* Report active status of specified module.
*
* @param string $module name of specified module
* @return boolean boolean specifying if the named module is active or not
*/
public static function isModuleActive( $module_name ) {

$activeModules = Endurance_ModuleRegistry::collection()->where( 'isActive', '===', true )->all();

foreach ( $activeModules as $name => $module ) {
if ( $module_name === $name ) {
return true;
}
}

return false;
}
}

0 comments on commit bbcef0b

Please sign in to comment.