Packages that extend Tiki | |
This feature is available from Tiki 20. Packages that extend Tiki (also known as Tiki Extension Packages) are used if you are writing your own custom code that you want to conveniently install as a Package. See also module package. |
Basics | |
Installing | |
Firstly, you will need to make the package required via Composer. Assuming that the package is hosted on the public packagist or on composer.tiki.org, you can do this via the command line while in the Tiki root folder:
If your package is not on the public packagist or on composer.tiki.org, then you first have to add a repo first to composer.json in the root of Tiki folder before running the above package. For examples: Copy to clipboard
Copy to clipboard
Your package contents must be a valid composer packages, i.e. have a valid composer.json in its root folder. It must also have a tiki-package.json file (see below under Enabling for more information). Warning: PHP namespaces do not allow hyphens, so you should use a vendor and package name that is using underscores instead. |
Updating | |
This can be done through composer: |
Enabling | |
Before an Extension Package can be enabled (i.e. used in Tiki), it needs to be enabled. To be identified as an extension package you need to have a tiki-package.json in the contents of the package. This JSON file is used to set configurations if necessary, but a json file containing just Enabling can be done through the Console: Disabling can be done similarly: Once installed, enabling and disabling can also be done from the admin panel from the web under Packages. |
Example demo package | |
If you are a developer that is new at this, you can get a example demo package from https://gitlab.com/synergiq/tiki-custom-package-demo to help you get started. |
What can you do in extension packages? | |
Add custom CSS | |
This can be done by creating css files in a |
Add custom prefs | |
This can be done by adding a Copy to clipboard
NOTE: It is double underscore between vendor and packagename, and also right after the packagename and the rest of the preference name These custom prefs can be set on the Tiki Control Panel on the Packages page under the "Extensions Preferences" tab.
|
Adding templates | |
The To avoid conflict with other templates, please prefix your templates with your vendorname, e.g. vendor-templatename.tpl Subfolders should be created analogously to the Tiki default "templates" folder for features such as "activity" for custom PluginActivityStream templates, e.g. in |
Adding Themes to be installed | |
If you have a complete theme/s, you can package it/them within the Package simply by putting it/them within the If you update the theme files in your package and want to do an update, you will need to increment the version number in composer.json of your package, and enable the package again. |
Adding Translations | |
As of Aug 2019, this only supports PHP translations, and need to be enhanced to support JS translations too. To add translations, create a Copy to clipboard
If you update the your language files, you will need to increment your package version in its composer.json and re-enable the package again. |
Adding Profiles | |
Profiles that are added to an Extension Package automatically gets applied when the Package is enabled. To add profiles, add them to the Copy to clipboard
If you add new profiles, you will have to increment your package version in its composer.json and re-enable the Package to execute them. Profiles that are already applied are not re-executed. If you really want to re-execute a profile, you will have to manually forget that profile, e.g. When you disable a Package, the profile is still considered applied and the items created by that profile will still exist. If you want to totally rollback the changes the profile made, you will have to specify the |
Adding Wiki Plugins | |
For the purpose of namespacing as well as to centralize the entrypoint for Wiki Plugins that are added through Extension Packages (and thus they can be enabled/disabled together with the package), all such added plugins are accessed through one Wiki Plugin, the PluginPackage. Say you have a plugin that prints out "This is a demo plugin." Create within the Copy to clipboard
|
Adding Custom PHP Libs | |
Warning: PHP namespaces do not allow hyphens, so you should use a vendor and package name that is using underscores instead Add any custom libs into the Copy to clipboard
|
Binding to Tiki events | |
This is used when you want to carry out some custom actions when Tiki Events happen. For example, whenever a wiki page is created you want to do something custom (e.g. execute DemoLib->testeventdemo() as follows). Copy to clipboard
|
Adding custom search fields to objects being indexed | |
This is useful if you want to add custom fields that are based on rules that are not generic to Tiki. For example, let us say you want to look up some 3rd party system and index in the values corresponding to the values in the tracker item being indexed. You first need to create a search source lib in your Copy to clipboard
To bind this to the indexing, you just have to add the following to the tiki-package.json file: Copy to clipboard
|
Adding custom AJAX services | |
Tiki has built-in AJAX services - the code is in To do this, first put your service within your Copy to clipboard
Then, add a config/services.xml to your package:Copy to clipboard
Page Aliases |