Skip to content

Latest commit

 

History

History
32 lines (27 loc) · 731 Bytes

typo3-site-configuration.md

File metadata and controls

32 lines (27 loc) · 731 Bytes

Adding a field to the site configuration

// Configure a new simple required input field to site
$GLOBALS['SiteConfiguration']['site']['columns']['myNewField'] = [
    'label' => 'A new custom field',
    'config' => [
        'type' => 'input',
        'eval' => 'required',
    ],
];

// And add it to showitem
$GLOBALS['SiteConfiguration']['site']['types']['0']['showitem'] = str_replace(
    'base,',
    'base, myNewField, ',
    $GLOBALS['SiteConfiguration']['site']['types']['0']['showitem']
);

Accessing the extended field in a cObject

SITE_VALUE = TEXT
SITE_VALUE.data = site:myNewField

Accessing the extended field in a condition

[site("configuration")["myNewField"] == "myCustomValue"]
...