This extension provides a module to show a website configuration form allowing
users without any technical knowledge to easily configure main aspects from a
website.
Behind the scene the extension provides mappers to bind form fields with
TypoScript constants, site configuration or the configuration record from
the extension. To setup the edit form the following steps are involved:
Define the TCA
If needed create event handlers for advanced configurations
An example setup can be found in the commit
351c6af
from the extension pizpalue.
Note
To setup the configuration form integrator or developer skills are required.
Screenshots
Website configuration form
Configuration
Agency information
When closing the form editor an info panel is shown providing agency related
links. The links can be defined in the site configuration or in the typoscript
setup.
Writes the property value obtained from the field always to the typoscript
file, even if the inherited value is equal. The normal behaviour is to write
only changed property values to the file. This feature is useful where
property values depend on conditions. In such cases the inherited value
doesn't necessarily reflect the real value. As an example assume a menu
property having a different value on subpages.
Defines the property path used my the mapper to read and write the
corresponding configuration.
TypoScript constants substitution
Starting with TYPO3 v12 TypoScript constants aren't substituted any more: The
assignment b = {$a} with a = test results in
b = {$a} and not in b = test. Especially when
configuring various extensions it would be faster to just set some global
constants and assign them accordingly. Here the TypoScript substitution feature
comes into play:
Map form values to TypoScript constants, the site configuration
or the easyconf table.
Audience: Integrators, Developers
Using mappers
Audience: Integrators, Developers
A form value can be mapped to a TypoScript constant, a site configuration
property or a field from the configuration table from this extension. The
mapping is defined in a php file located under Configuration/TCA/Overrides
and assisted by helper functions from the extension TcaUtility class.
Basic TCA-file structure
<?phpuseBuepro\Easyconf\Mapper\EasyconfMapper;
useBuepro\Easyconf\Mapper\SiteConfigurationMapper;
useBuepro\Easyconf\Mapper\TypoScriptConstantMapper;
useBuepro\Easyconf\Utility\TcaUtility;
defined('TYPO3') ordie('Access denied.');
if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('easyconf')) {
return;
}
(staticfunction(){
$l10nFile = 'LLL:EXT:site_package/Resources/Private/Language/locallang_db.xlf';
$tca = &$GLOBALS['TCA']['tx_easyconf_configuration'];
/**
* Define columns
*/
$propertyMaps = [
// ***************************// * Here we use the mappers *// ***************************
];
$tca['columns'] = TcaUtility::getColumns($propertyMaps, $l10nFile);
/**
* Define palettes
*/// .../**
* Modify columns
*/// .../**
* Define type (tabs from the form with palettes and fields)
*/// ...unset($tca);
})();
Copied!
Note
Replace site_package with the key from your extension key.
TypoScript constant mapper
Description
On each page where a template record is available TypoScript constants can be
altered through form fields. This is achieved by creating a template related
file holding the constant definitions and importing this file through the
template constants definition.
Note
The inheritance hierarchy from TypoScript is maintained meaning if you set
a field value on the root page it can be overwritten on subpages (if a
template record exists for that subpage).
Note
The way the TypoScript file import is maintained in the template constants
field can be adjusted by the TypoScript constant
module.tx_easyconf.settings.typoScriptConstantMapper.importStatementHandling.
This mapper relates form fields with the site configuration hence writes and
reads from the site configuration yaml file.
Note
Since these fields have site scope a change on one page is shown on all
other pages having a template record meaning no hierarchical configuration
is possible as known from the TypoScript mapping.
This mapper relates form fields with the field fields from the table
tx_easyconf_configuration. For each page a template record exists a
record is created in the table tx_easyconf_configuration. As a result
these form values have a template scope.