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
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 | |
|
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
|
Adding templates | |
The To avoid conflict with other templates, please prefix your templates with your vendorname, e.g. vendor-templatename.tpl
|
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
|
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
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
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 Copy to clipboard
|