As a developer
I want to know how to create my own distribution
- Document how to create a distribution
#1 Updated by Benni Mack about 6 years ago
- Description updated (diff)
- translation missing: en.field_remaining_hours set to 0.0
What's in a distribution?
Starting with TYPO3 CMS 6.2, the TYPO3 CMS Core can deal with distributions. A distribution is at it’s base a typical TYPO3 extension. However, a distribution is usually there to deliver not just code or additional database fields and tables, but also content and / or pre-configured settings to run sites directly with just a few configuration tweaks. It is also possible to run multiple distributions at the same time in one TYPO3 CMS system, as they only provide records (pages, content etc.), typoscript and other settings. This is done by installing an extension that provides additional content and files.
Distributions can be found like extensions on typo3.org. They are available in the TYPO3 Extension Repository and can be downloaded via the Extension Manager in the TYPO3 backend. Additionally, in the extension manager there is an extra submodule called “Distributions” to show more information about available distributions, install and configure a distribution.
Creating your own distribution
As a distribution is just a TYPO3 extension, it needs only two files: ext_emconf.php and ext_icon.gif. In the ext_emconf.php file the category option needs to be set to “distribution”. Let’s take an extension called “mydistrib” to see what is needed.
[IMAGE with two files]
- Important files for a distribution
There are two more files, showing a preview icon in the Distributions section of the Extension Manager of TYPO3 CMS. Place two images in a subfolder called “XYZ”.
[IMAGE with folder structure]
Talking about content in TYPO3 usually means records in the database, and files (usually put in the fileadmin/ folder). Database records are added via a t3d file, which is a compressed data array containing certain DB records and their references, created and imported via the system extension Import/Export that is shipped with every TYPO3 installation. It handles the t3d file format automatically. If a distribution called “mydistrib" contains a t3d file named XXX that is placed in the subfolder XYZ, the DB data will be imported on root level of the TYPO3 installation.
Please note that a single TYPO3 installation remembers if the initial data import was done before (via a sys_registry entry), so if a distribution is uninstalled and installed again, the data will not be imported again.
- Managing dependencies and conflicts
If the distribution needs an extension available in the TER, or conflicts with another extension, the corresponding entry in composer.json and/or ext_emconf.php needs to be added. The usual download process for dependencies is done when installing a distribution.
- Managing dependencies not from TER
If your distribution depends on another extension that is not in the TER, the required extension can be put in the subfolder XYZ unextracted. If required in ext_emconf.php, the extension will be checked and the data will be copied to typo3conf/ext/ and installed.
-- Delivering your data
Creating the data for a distribution is done best when having an existing and clean installation that contains all the data. Move the files you want to ship into fileadmin/mydistrib (or like your extension). Do this via the TYPO3 file list in order to keep the references to the File Abstraction Layer. Click in the page tree on the page you want to export (or on PID 0) and click “Import/Export” and configure a preset what data should be exported. Using export presets help to create new versions more easily, it is also helpful to document the preset settings in your code versioning system. Export the database relations as a t3d file and move this file in your EXT:mydistrib/Initialisation/data.t3d. Copy all files from fileadmin/mydistrib/* to EXT:mydistrib/Initialisation/Files/.
- Export Preset for EXT:introduction
#5 Updated by Francois Suter over 4 years ago
I just stumbled on this issue. Creating a distribution is documented in Core APIs: https://docs.typo3.org/typo3cms/CoreApiReference/ExtensionArchitecture/CreateNewDistribution/Index.html
Feel free to improve that page if needed.