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 [2025/08/21 18:17] – [Presenter classes] mightymcoderen:entwickler:plugin_manager [2026/02/01 18:48] (current) – [Plugin Manager] mightymcoder
Line 9: Line 9:
 plugins in Admidio. plugins in Admidio.
  
 +A Basic //"Overview Plugin Example"// can by found here: [[https://github.com/Admidio/admidio-overview-plugin-example|Admidio Overview Plugin Example]]
 ======== Make your plugin compatible with the Plugin Manager (Admidio 5) ======== ======== Make your plugin compatible with the Plugin Manager (Admidio 5) ========
 To make your plugin compatible with the Plugin Manager certain requirements must first be met. These include: To make your plugin compatible with the Plugin Manager certain requirements must first be met. These include:
   * [[en:entwickler:plugin_manager#naming_conventions|Naming conventions]]   * [[en:entwickler:plugin_manager#naming_conventions|Naming conventions]]
   * A consistent [[en:entwickler:plugin_manager#folder_structure|folder structure]]   * A consistent [[en:entwickler:plugin_manager#folder_structure|folder structure]]
-  * Use of the new plugin namespace //Plugins// +  * A [[en:entwickler:plugin_manager#plugin_preferences_class|preference presenter class]] with a [[en:entwickler:plugin_manager#single_formpresenter_element|single FormPresenter element]] or with [[en:entwickler:plugin_manager#multiple_formpresenter_elements|multiple FormPresenter elements]]
-  * A [[en:entwickler:plugin_manager#plugin_preferences_class|preference presenter class]]+
   * A [[en:entwickler:plugin_manager#plugin_class|plugin class]]   * A [[en:entwickler:plugin_manager#plugin_class|plugin class]]
   * A JSON [[en:entwickler:plugin_manager#configuration_file|configuration file]]   * A JSON [[en:entwickler:plugin_manager#configuration_file|configuration file]]
  
 ======= Naming conventions ======= ======= Naming conventions =======
-To use the new plugin namespace //Plugins// some naming conventions must be observed: +To use the new Plugin Manager some naming conventions must be observed: 
-  - No plugin folder or file may contain delimiters such as //"-"// or //"_"// especially if it will be used via a class import. For consistency only the optional folder //db_scripts// (see: [[en:entwickler:plugin_manager#folder_structure|folder structure]]) is exempt from this rule. +  - For better readability file and folder names containing multiple words should follow snake_case (underscore separated) notation. 
-  - For better readability file and folder names containing multiple words should follow CamelCase notation. +  - All folder and file names containing multiple words and are placed inside the //classes// folder should follow UpperCamelCase (PascalCase) notation. 
 +  - No plugin file defining a class may contain delimiters such as //"-"// or //"_"// especially if it will be used via a class import.
 ======= Folder structure ======= ======= Folder structure =======
 The basic folder structure of any plugin is shown below using the "Birthday" overview plugin as an example: The basic folder structure of any plugin is shown below using the "Birthday" overview plugin as an example:
Line 239: Line 239:
 This makes it possible to show seperate forms on the same page. There are no limits to the display options whether as cards (as in the example), tabs, or accordions. With this approach each available Bootstrap/HTML display is possible through the smarty templates. This makes it possible to show seperate forms on the same page. There are no limits to the display options whether as cards (as in the example), tabs, or accordions. With this approach each available Bootstrap/HTML display is possible through the smarty templates.
  
-==== Entity, Service and ValueObjects classes ====+===== Entity, Service and ValueObjects classes =====
 If the plugin has specific //Entity//, //Service//, or //ValueObjects// classes these should be placed in the corresponding subfolders as is done with the Admidio modules. If the plugin has specific //Entity//, //Service//, or //ValueObjects// classes these should be placed in the corresponding subfolders as is done with the Admidio modules.
  
-==== Main plugin class ====+===== Main plugin class =====
 The main [[en:entwickler:plugin_manager#plugin_class|plugin class]] (e.g.: //Birthday//) must be placed directly in the //classes// folder. The main [[en:entwickler:plugin_manager#plugin_class|plugin class]] (e.g.: //Birthday//) must be placed directly in the //classes// folder.
  
-===== db_scripts folder =====+====== db_scripts folder ======
 This folder is optional and is used to place plugin-specific database scripts used when installing (//db-install.sql//) or uninstalling (//db-uninstall.sql//) the plugin. This folder is optional and is used to place plugin-specific database scripts used when installing (//db-install.sql//) or uninstalling (//db-uninstall.sql//) the plugin.
  
Line 280: Line 280:
 </code> </code>
  
-===== languages folder =====+====== languages folder ======
 This folder contains the plugin-specific translation files. This folder contains the plugin-specific translation files.
  
-===== templates folder =====+====== templates folder ======
 To move away from the deprecated //HtmlPage// and //HtmlTable// classes plugins should exclusively use the Smarty template engine with files stored in this folder. To move away from the deprecated //HtmlPage// and //HtmlTable// classes plugins should exclusively use the Smarty template engine with files stored in this folder.
  
-===== Root plugin folder =====+====== Root plugin folder ======
        
      
-==== Main plugin file ====+===== Main plugin file =====
 Inside the root plugin folder a main plugin file is required. This file can contain plugin-specific logic (similar to Admidio’s module entry files) or simply initialize the [[en:entwickler:plugin_manager#plugin_class|plugin class]] as in the following example: Inside the root plugin folder a main plugin file is required. This file can contain plugin-specific logic (similar to Admidio’s module entry files) or simply initialize the [[en:entwickler:plugin_manager#plugin_class|plugin class]] as in the following example:
 <code php> <code php>
 <?php <?php
-use Plugins\Birthday\classes\Birthday;+use Birthday\classes\Birthday;
  
 /** /**
Line 318: Line 318:
 </code> </code>
  
-==== Plugin configuration file ====+===== Plugin configuration file =====
 Each plugin must provide a JSON configuration file containing basic plugin information and configuration (see: [[en:entwickler:plugin_manager#configuration_file|Configuration file]]). Each plugin must provide a JSON configuration file containing basic plugin information and configuration (see: [[en:entwickler:plugin_manager#configuration_file|Configuration file]]).
  
  
-====== Configuration file ======+======= Configuration file =======
 Each plugin has to provide a JSON configuration file. The following table gives an overview of all keys currently available: Each plugin has to provide a JSON configuration file. The following table gives an overview of all keys currently available:
  
Line 333: Line 333:
 | "icon" | | The icon displayed in the Admidio sidebar and on the Plugin Manager overview. | | "icon" | | The icon displayed in the Admidio sidebar and on the Plugin Manager overview. |
 | "mainFile" | | The filename of the main plugin entry point. If not set "index.php" or "PluginName.php" is assumed. | | "mainFile" | | The filename of the main plugin entry point. If not set "index.php" or "PluginName.php" is assumed. |
 +| "overviewPlugin" | | This optional flag is used to determinate whether the plugin should be installed as an overview plugin. |
 +| "autoload" |  (X)  | An object containing another object "psr-4" which contains the psr4 autoload mapping(s) of the plugin class(es). |
 +| "preferencesFile" | | The filename of the preferences entry point for the plugin settings. If this key is set there is no integration of the plugin settings into the Admidio Preferences Page. |
 | "hasSubcards" | | This optional flag is used to determinate whether a plugins preference page contains multiple "cards" to display (for CSS styling purposes only). | | "hasSubcards" | | This optional flag is used to determinate whether a plugins preference page contains multiple "cards" to display (for CSS styling purposes only). |
 | "dependencies" |  (X)  | An array of all dependencies the plugin needs to work properly. If this is not set the Plugin Manager cannot detect whether the plugin can be installed properly. | | "dependencies" |  (X)  | An array of all dependencies the plugin needs to work properly. If this is not set the Plugin Manager cannot detect whether the plugin can be installed properly. |
Line 340: Line 343:
 <code json> <code json>
 { {
-  "name": "PLG_BIRTHDAY_PLUGIN_NAME", +    "name": "PLG_BIRTHDAY_PLUGIN_NAME", 
-  "description": "PLG_BIRTHDAY_PLUGIN_DESCRIPTION", +    "description": "PLG_BIRTHDAY_PLUGIN_DESCRIPTION", 
-  "version": "1.0.0", +    "version": "1.0.0", 
-  "author": "Admidio Team", +    "author": "Admidio Team", 
-  "url": "https://www.admidio.org", +    "url": "https://www.admidio.org", 
-  "icon": "bi-cake2", +    "icon": "bi-cake2", 
-  "mainFile": "index.php", +    "mainFile": "index.php", 
-  "dependencies":+    "overviewPlugin": true, 
-    "Admidio\\Infrastructure\\Plugins\\Overview", +    "autoload":
-    "Admidio\\Infrastructure\\Plugins\\PluginAbstract", +        "psr-4":
-    "Admidio\\Infrastructure\\Utils\\SecurityUtils", +            "Birthday\\classes\\": "classes/" 
-    "Admidio\\Roles\\Service\\RolesService" +        } 
-  ],+    }, 
 +    "dependencies":
 +        "Admidio\\Infrastructure\\Plugins\\Overview", 
 +        "Admidio\\Infrastructure\\Plugins\\PluginAbstract", 
 +        "Admidio\\Infrastructure\\Utils\\SecurityUtils", 
 +        "Admidio\\Roles\\Service\\RolesService" 
 +    ], 
 +    "defaultConfig":
 +        "birthday_plugin_enabled":
 +            "name": "ORG_ACCESS_TO_PLUGIN", 
 +            "description": "ORG_ACCESS_TO_PLUGIN_DESC", 
 +            "type": "integer", 
 +            "value" : 1 
 +        }, 
 +        "birthday_overview_sequence":
 +            "type": "integer", 
 +            "value" : 2 
 +        }, 
 +        "birthday_show_names_extern":
 +            "name": "PLG_BIRTHDAY_PREFERENCES_SHOW_NAMES_EXTERN", 
 +            "description": "PLG_BIRTHDAY_PREFERENCES_SHOW_NAMES_EXTERN_DESC", 
 +            "type": "boolean", 
 +            "value" : false 
 +        }, 
 +        "birthday_show_names":
 +            "name": "PLG_BIRTHDAY_PREFERENCES_SHOW_NAMES", 
 +            "description": "PLG_BIRTHDAY_PREFERENCES_SHOW_NAMES_DESC", 
 +            "type": "integer", 
 +            "value" : 0 
 +        }, 
 +        "birthday_show_age":
 +            "name": "PLG_BIRTHDAY_PREFERENCES_SHOW_AGE", 
 +            "description": "PLG_BIRTHDAY_PREFERENCES_SHOW_AGE_DESC", 
 +            "type": "boolean", 
 +            "value" : false 
 +        }, 
 +        "birthday_show_age_salutation":
 +            "name": "PLG_BIRTHDAY_PREFERENCES_SHOW_AGE_SALUTATION", 
 +            "description": "PLG_BIRTHDAY_PREFERENCES_SHOW_AGE_SALUTATION_DESC", 
 +            "type": "integer", 
 +            "value" : 18 
 +        }, 
 +        "birthday_show_notice_none":
 +            "name": "PLG_BIRTHDAY_PREFERENCES_SHOW_NOTICE_NONE", 
 +            "description": "PLG_BIRTHDAY_PREFERENCES_SHOW_NOTICE_NONE_DESC", 
 +            "type": "boolean", 
 +            "value" : true 
 +        }, 
 +        "birthday_show_past":
 +            "name": "PLG_BIRTHDAY_PREFERENCES_SHOW_PAST", 
 +            "description": "PLG_BIRTHDAY_PREFERENCES_SHOW_PAST_DESC", 
 +            "type": "integer", 
 +            "value" : 1 
 +        }, 
 +        "birthday_show_future":
 +            "name": "PLG_BIRTHDAY_PREFERENCES_SHOW_FUTURE", 
 +            "description": "PLG_BIRTHDAY_PREFERENCES_SHOW_FUTURE_DESC", 
 +            "type": "integer", 
 +            "value" : 2 
 +        }, 
 +        "birthday_show_display_limit":
 +            "name": "PLG_BIRTHDAY_PREFERENCES_SHOW_DISPLAY_LIMIT", 
 +            "description": "PLG_BIRTHDAY_PREFERENCES_SHOW_DISPLAY_LIMIT_DESC", 
 +            "type": "integer", 
 +            "value" : 200 
 +        }, 
 +        "birthday_show_email_extern":
 +            "name": "PLG_BIRTHDAY_PREFERENCES_SHOW_EMAIL_EXTERN", 
 +            "description": "PLG_BIRTHDAY_PREFERENCES_SHOW_EMAIL_EXTERN_DESC", 
 +            "type": "integer", 
 +            "value" : 0 
 +        }, 
 +        "birthday_roles_view_plugin":
 +            "name": "PLG_BIRTHDAY_PREFERENCES_ROLES_VIEW_PLUGIN", 
 +            "description": "PLG_BIRTHDAY_PREFERENCES_ROLES_VIEW_PLUGIN_DESC", 
 +            "type": "array", 
 +            "value" : ["All"
 +        }, 
 +        "birthday_roles_sql":
 +            "name": "PLG_BIRTHDAY_PREFERENCES_ROLES_SQL", 
 +            "description": "PLG_BIRTHDAY_PREFERENCES_ROLES_SQL_DESC", 
 +            "type": "array", 
 +            "value" : ["All"
 +        }, 
 +        "birthday_sort_sql":
 +            "name": "PLG_BIRTHDAY_PREFERENCES_SORT_SQL", 
 +            "description": "PLG_BIRTHDAY_PREFERENCES_SORT_SQL_DESC", 
 +            "type": "string", 
 +            "value" : "DESC" 
 +        } 
 +    } 
 +],
   "defaultConfig": {   "defaultConfig": {
     "birthday_plugin_enabled": {     "birthday_plugin_enabled": {
Line 436: Line 530:
 </code> </code>
  
-====== Plugin class ======+======= Plugin class =======
 The //Plugin// class extends the basic functionality provided by the abstract class //PluginAbstract// and implements the //doRender// method. The //Plugin// class extends the basic functionality provided by the abstract class //PluginAbstract// and implements the //doRender// method.
  
Line 474: Line 568:
 </code> </code>
  
-======= PluginAbstract class =======+======== PluginAbstract class ========
 <WRAP center round todo 60%> <WRAP center round todo 60%>
 methods documentation methods documentation
 </WRAP> </WRAP>
  • en/entwickler/plugin_manager.1755793066.txt.gz
  • Last modified: 2025/08/21 18:17
  • by mightymcoder