Module Management Class
The Mod class is the primary orchestrator for the GeniXCMS extension ecosystem. It manages the entire lifecycle of modules (plugins), from discovery and metadata extraction to activation, deactivation, and administrative interface integration.
⚡ Lifecycle & State Management
Mod::activate(string $module_slug)
Registers a module in the system's active registry. This method is called when an administrator clicks "Install/Activate" in the dashboard.
- Process: Triggers optional database migrations and attaches core hooks.
- Return:
bool (Success of activation).
Mod::deactivate(string $module_slug)
Unregisters the module from the active list. The module files remain on the server, but all hooks and administrative links are suppressed.
Mod::isActive(string $module_slug)
A high-frequency utility method used throughout the system to check if a specific feature set is available.
if (Mod::isActive('contact-form')) {
// Render contact form logic...
}
🏗️ Metadata & Entry Points
Mod::data(string $module_slug)
Parses the header comment from a module's index.php to extract versioning, author, and description data.
/**
* Name: My Engine
* Version: 2.1.0
* Developer: GeniXCMS Team
*/
$meta = Mod::data('my-engine');
echo $meta['Name']; // Output: My Engine
echo $meta['Version']; // Output: 2.1.0
🎨 Administrative Integration
The Mod class handles how modules appear and behave within the GeniXCMS dashboard.
Mod::addMenuList(array $menus)
Allows modules to register custom administration pages that appear in the Admin > Modules dropdown or sidebar.
// Typically called in the module constructor
$pages = [
'analytics' => 'Site Traffic Analytics',
'reports' => 'Monthly Sales'
];
Mod::addMenuList($pages);
Mod::options(string $module_slug)
Automatically includes the options.php file for a specific module, allowing for a centralized settings experience without manual include calls.
📂 Module Internal Utilities
Mod::inc(string $file, ...)
A secure loader for module-specific internal libraries and views.
- Purpose: Prevents path resolution issues across different server environments.
- Usage:
Mod::inc('MyLibrary.lib', $data, 'inc/').
lightbulbTipDeveloper Quick Start: To start building a module with all required structures already in place, use the GeniX CLI:
php genix make:module my-new-feature
See Also