Custom Znuny plugin & module development
Need custom features or legacy package updates? Softoft builds maintainable, release-ready Perl and web modules for Znuny.
.sopmThe SOPM file (*.sopm) contains all metadata for your package:
`.sopm“
Create your package in its own directory, e.g., MyExtension/:
*.sopm
Use the CLI tool to build an OPM from your SOPM:
MyExtension/
Kernel/Config/Files/XML/MyExtension.xml
To uninstall or update:
Kernel/System/DynamicField/Driver/MyCustomField.pmIn Kernel/Config/Files/XML/MyExtension.xml, you register a new Dynamic Field Driver:
Kernel/System/Event/Handler/MyHandler.pm
Implement the driver in Kernel/System/DynamicField/Driver/MyCustomField.pm.
Register your event handler:
Run()
Implement the handler in Kernel/System/Event/Handler/MyHandler.pm (Run() method).
Kernel/System/Output/Filter/MyFilter.pm
Implement the filter in Kernel/System/Output/Filter/MyFilter.pm.Packages.xml for your own repo:
Packages.xmlPackage::RepositoryList.MyCalendar.sql/create_calendar.sql for table calendar_events.Kernel/System/CalendarEvent.pm with CRUD methods.Kernel/Modules/AgentCalendar.pm, template AgentCalendar.tt.sopm (SemVer).sql/ cleanly.Language/de_*.pm and en_*.pm.
With this, you have a solid foundation to develop, distribute, and maintain your own Znuny plugins in customer projects. Have fun!Custom Znuny plugin & module development
Need custom features or legacy package updates? Softoft builds maintainable, release-ready Perl and web modules for Znuny.
A Znuny OPM (Open Package Manager) package is structured to encapsulate all necessary files and metadata for a plugin. At its core is the .sopm file, which serves as the package's manifest, containing crucial metadata like the package name, version, and compatible Znuny framework versions. It also lists all files that will be installed. The package's directory structure typically includes Kernel/Config/Files/XML/ for registering modules, menus, or Dynamic Fields, Kernel/System/ for business logic classes, Kernel/Modules/ for frontend controllers, and Templates & Language for Twig template files and translation .pm files. This organized structure ensures that all plugin components are correctly placed within the Znuny application during installation.
Quellen / Sources:
To build a custom Znuny OPM package, you typically use a command-line interface (CLI) tool that processes your .sopm file and the associated plugin directory structure to generate the .opm package file. Once built, there are two primary methods for installation. For graphical installation, you can upload the .opm package directly through the Znuny Admin UI by navigating to Admin → Settings → Package Manager. Alternatively, for console-based installation, you can use a command-line utility, often found within the Znuny bin/ directory, to install the package. This method is particularly useful for automated deployments or server environments without direct UI access. The Package Manager also handles updates and uninstallation, ensuring a consistent lifecycle for your plugin.
Quellen / Sources:
Znuny offers several extension points to integrate custom functionality into the system. One common method is through Dynamic Fields, where you can register a new Dynamic Field Driver in Kernel/Config/Files/XML/MyExtension.xml and implement its logic in Kernel/System/DynamicField/Driver/MyCustomField.pm. This allows for custom data input and display. Another powerful extension point is Event Handlers, which enable your plugin to react to specific events within Znuny. You register the handler and implement its Run() method in Kernel/System/Event/Handler/MyHandler.pm. Lastly, Output Filters allow you to modify the content generated by Znuny before it is displayed to the user. You implement the filter logic in Kernel/System/Output/Filter/MyFilter.pm. These extension points provide robust ways to customize and extend Znuny's core behavior.
Quellen / Sources:
Distributing your Znuny OPM package involves making it accessible for others to install. One method is to create a Repository Index, which is an XML file named Packages.xml. This file lists all available OPM packages in your custom repository. Once Packages.xml is set up on a web server, users can add your repository URL to their Znuny system via the SysConfig setting Package::RepositoryList. This allows them to browse and install your packages directly from within their Znuny Package Manager, similar to official repositories. Another convenient option for broader distribution is to upload your OPM package to OTOpar (e.g., https://otopar.perl-services.de). OTOpar is a public platform where developers can share their OPM packages, enabling other Znuny users to easily discover and install them directly through the Package Manager.
Quellen / Sources:
Adhering to best practices ensures your Znuny plugins are robust, maintainable, and compatible. Always adjust the version number in your .sopm file following Semantic Versioning (SemVer) guidelines for clear release management. When dealing with database changes, meticulously version your DB migrations in the sql/ directory to ensure smooth updates and rollbacks. For critical functionality, create unit tests for your system and module classes to verify correctness and prevent regressions. Comprehensive documentation is vital; include a README file with installation and usage instructions, and use POD (Plain Old Documentation) within your Perl modules for in-code explanations. Finally, provide translations for your plugin by creating Language/de_*.pm and en_*.pm files, making your plugin accessible to a wider audience. These practices contribute to a high-quality plugin development experience.
Quellen / Sources: