Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:entwickler:plugin_manager [2026/02/08 12:03] – [PluginAbstract class] mightymcoderen:entwickler:plugin_manager [2026/02/08 12:14] (current) – [Singleton / Basic Handling] mightymcoder
Line 598: Line 598:
 methods documentation methods documentation
 </WRAP> </WRAP>
 +
 The //PluginAbstract// class is the base class for all plugins usable with the Plugin Manager. The //PluginAbstract// class is the base class for all plugins usable with the Plugin Manager.
  
Line 610: Line 611:
 All custom plugins should extend this class. All custom plugins should extend this class.
  
-===== Configuration & Metadata =====+----- 
 + 
 +===== Singleton / Basic Handling =====
 ^ Method ^ Description ^ Return ^ ^ Method ^ Description ^ Return ^
-| getPluginConfig() | Returns merged plugin configuration (defaults + stored DB values) | array | +| getInstance() | Returns the singleton instance of the plugin class | PluginAbstract | 
-| getPluginPath() | Absolute filesystem path of plugin | string | +| <nowiki>__construct()</nowiki> | Protected constructor (singleton pattern) | void | 
-| getComponentId() | Database component ID (components.com_id) | int | +| <nowiki>__clone()</nowiki> | Prevents cloning of the singleton | void | 
-| getComponentName() | Folder name of the plugin | string | +| <nowiki>__wakeup()</nowiki> | Prevents unserializing | void | 
-| getPluginSequence() | Overview sorting sequence from config | int |+ 
 +----- 
 + 
 +===== Menu Integration / Preferences ===== 
 +^ Method ^ Description ^ Return ^ 
 +| addMenuEntry() | Adds the plugin menu entry to the database | void | 
 +| removeMenuEntry() | Removes the plugin menu entry from the database | void | 
 +| initPreferencePanelCallback() | Initializes plugin preference panel integration | void | 
 + 
 +----- 
 + 
 +===== Metadata / Identity ===== 
 +^ Method ^ Description ^ Return ^ 
 +| getName() | Returns the plugin name | string | 
 +| getIcon() | Returns the plugin icon from metadata | string | 
 +| getVersion() | Returns the plugin version | string | 
 +| getMetadata() | Returns the complete metadata definition | array | 
 +| getDependencies() | Returns declared dependencies | array | 
 +| getSupportedLanguages() | Returns supported languages | array | 
 + 
 +----- 
 + 
 +===== Static Files ===== 
 +^ Method ^ Description ^ Return ^ 
 +| getStaticFiles(?string $type = null, string $path = '') | Returns plugin static files (css/js/images/etc.) | array | 
 + 
 +Example: 
 +<code php> 
 +Plugin::getStaticFiles('css'); 
 +</code> 
 + 
 +----- 
 + 
 +===== Configuration & Component Information ===== 
 +^ Method ^ Description ^ Return ^ 
 +| getPluginConfigValues() | Returns stored config values only (key => value) | array | 
 +| getPluginConfig() | Returns merged configuration (defaults + DB) | array | 
 +| getPluginPath() | Absolute filesystem path | string | 
 +| getComponentId() | Database component ID | int | 
 +| getComponentName() | Plugin folder name | string | 
 +| getPluginSequence() | Overview sorting sequence | int | 
 + 
 +-----
  
 ===== Dependency Handling ===== ===== Dependency Handling =====
 ^ Method ^ Description ^ Return ^ ^ Method ^ Description ^ Return ^
-| checkDependencies() | Verifies that all declared plugin dependencies exist | bool |+| checkDependencies() | Verifies all dependencies are available | bool |
  
 +Internal helper:
 <code php> <code php>
-private findAdmidioClass(string $shortName): ?string+private static function findAdmidioClass(string $shortName): ?string
 </code> </code>
-Searches the Admidio namespace for a class file. 
  
-===== Installation State =====+----- 
 + 
 +===== Installation State / Visibility =====
 ^ Method ^ Description ^ Return ^ ^ Method ^ Description ^ Return ^
-| isInstalled() | Plugin entry exists in database | bool | +| isInstalled() | Plugin exists in database | bool | 
-| isActivated() | Installed and active | bool | +| isActivated() | Installed and activated | bool | 
-| isVisible() | Visible in UI depending on config and login state | bool |+| isVisible() | Visible depending on config and login state | bool |
 | isOverviewPlugin() | Registered as overview plugin | bool | | isOverviewPlugin() | Registered as overview plugin | bool |
-| isAdmidioPlugin() | Built-in Admidio overview plugin | bool | +| isAdmidioPlugin() | Built-in overview plugin | bool | 
-| isUpdateAvailable() | Installed version differs from metadata version | bool |+| isUpdateAvailable() | Installed version differs from metadata | bool | 
 + 
 +-----
  
 ===== Autoloading ===== ===== Autoloading =====
 ^ Method ^ Description ^ Return ^ ^ Method ^ Description ^ Return ^
-| doClassAutoload(string $class) | Registers PSR-4 autoload mappings from plugin metadata | bool |+| doClassAutoload(string $class) | Registers PSR-4 autoload mappings | bool |
  
 Example metadata: Example metadata:
- 
 <code json> <code json>
 "autoload": { "autoload": {
Line 649: Line 697:
 } }
 </code> </code>
 +
 +-----
  
 ===== Lifecycle Methods ===== ===== Lifecycle Methods =====
 +
 ==== doInstall(bool $addMenuEntry = true) ==== ==== doInstall(bool $addMenuEntry = true) ====
 Installs the plugin. Installs the plugin.
Line 664: Line 715:
 Returns: bool Returns: bool
  
-==== doUninstall(bool $removeMenuEntry = true, array $options = []) ====+---- 
 + 
 +==== doUninstall(bool $removeMenuEntry = true, array $options = array()) ====
 Removes the plugin completely. Removes the plugin completely.
  
Line 675: Line 728:
  
 Returns: bool Returns: bool
 +
 +----
  
 ==== doUpdate() ==== ==== doUpdate() ====
-Updates an already installed plugin.+Updates an installed plugin.
  
 Steps: Steps:
Line 686: Line 741:
 Returns: bool Returns: bool
  
-===== Internal Helpers =====+---- 
 + 
 +==== initParams(array $params = array()) ==== 
 +Optional initialization hook for plugins. 
 + 
 +Returns: bool 
 + 
 +----- 
 + 
 +===== Internal Helpers (private) =====
 ^ Method ^ Description ^ ^ Method ^ Description ^
 +| readPluginMetadata() | Loads and parses metadata file |
 +| getClassNameFromFile(string $file) | Extracts class name from PHP file |
 | toggleForeignKeyChecks(bool $enable) | Enables/disables MySQL foreign key checks during install/uninstall | | toggleForeignKeyChecks(bool $enable) | Enables/disables MySQL foreign key checks during install/uninstall |
-| initParams(array $params = []) | Optional initialization hook for plugins+
  • en/entwickler/plugin_manager.1770548629.txt.gz
  • Last modified: 2026/02/08 12:03
  • by mightymcoder