- Target groups: Integrators & Extension developers
The result of this discussion should be to find one common best practice for paths used to integrate extensions. This makes it easier for every integrator and especially for beginners.
Variants
Currently, there are 2 major options where templates for extensions are located.
Let’s imagine a site package with the extension key “site_demo” and 2 extensions: powermail, news.
Variant 1
Each extension has its own directory:
EXT:site_demo/Resources/Private/Extensions/
powermail/
Templates/
Form/Form.html
...
Partials
Form/Field/Input.html
...
Layouts
...
news
Templates/
News/List.html
...
Partials
Detail/MediaContainer.html
...
Layouts
...
powermail
Advantages:
- It is easy to copy & paste the integration from one installation to another because there is just one directory.
Variant 2
The templates, partials and layouts are grouped together.
EXT:site_demo/Resources/Private/
Templates
powermail
Form/Form.html
...
news
News/List.html
...
Partials
powermail
Form/Field/Input.html
...
news
Detail/MediaContainer.html
...
Layouts
news
...
powermail
...
Advantages:
- Currently used by bootstrap_package + https://www.sitepackagebuilder.com/
Not to be discussed
The following paths are not to be discussed yet:
- Location of templates/partials/layouts of content elements
- Location of templates/partials/layouts of pages
- Reusing same partials in multiple extensions, pages & content elements
Your opinion
Please share your opinion!
Possible Future
Having one best practice would allow us to auto setup the paths for all plugins. This would mean that if the site package extension is known to TYPO3 (e.g. registering it in the site config, see b13/bolt as an example)
Some background information
I taught TYPO3 extension development in the last semester at FH OÖ and many students had troubles with the various paths during extension development and integration.
It took a long time to understand which paths can be fully changed (EXT:site_demo/Resources/Private/Extension/news
) and which parts need to stay the same (Templates/News/List.html
).
For version 10
With the feature Site settings as TypoScript constants and in TSconfig any configuration can be defined in the site settings
settings:
paths:
templates: EXT:site_extension/Resources/Private/
Extensions as EXT:news just need to be shipped with a code like this
plugin.tx_news.view {
templateRootPaths.2 = {$settings.paths.templates}Extension/news/Templates/
partialRootPaths.2 = {$settings.paths.templates}Extension/news/Partials/
layoutRootPaths.2 = {$settings.paths.templates}Extension/news/Layouts/
}