2017-12-10 22:19:30 +01:00
|
|
|
<?php
|
|
|
|
|
2023-03-01 12:38:59 +01:00
|
|
|
(static function (
|
|
|
|
string $extensionName = 'abtest',
|
|
|
|
string $tableName = 'pages'
|
|
|
|
) {
|
|
|
|
$languagePath = 'LLL:EXT:' . $extensionName . '/Resources/Private/Language/locallang_db.xlf:' . $tableName . '.';
|
2017-12-10 22:19:30 +01:00
|
|
|
|
2023-03-01 12:38:59 +01:00
|
|
|
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns($tableName, [
|
|
|
|
'tx_abtest_variant' => [
|
|
|
|
'exclude' => 1,
|
|
|
|
'label' => $languagePath . 'tx_abtest_variant',
|
2023-03-06 14:39:21 +01:00
|
|
|
'description' => $languagePath . 'tx_abtest_variant.description',
|
2023-03-01 12:38:59 +01:00
|
|
|
'config' => [
|
|
|
|
'type' => 'group',
|
|
|
|
'allowed' => 'pages',
|
|
|
|
'maxitems' => 1,
|
|
|
|
'minitems' => 0,
|
|
|
|
'size' => 1,
|
|
|
|
'suggestOptions' => [
|
|
|
|
'default' => [
|
|
|
|
'addWhere' => 'AND pages.doktype = ' . \TYPO3\CMS\Core\Domain\Repository\PageRepository::DOKTYPE_DEFAULT,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'filter' => [
|
|
|
|
[
|
|
|
|
'userFunc' => \WerkraumMedia\ABTest\TCA\VariantFilter::class . '->doFilter',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'tx_abtest_cookie_time' => [
|
|
|
|
'exclude' => 1,
|
|
|
|
'label' => $languagePath . 'tx_abtest_cookie_time',
|
2023-03-06 14:39:21 +01:00
|
|
|
'description' => $languagePath . 'tx_abtest_cookie_time.description',
|
2023-03-01 12:38:59 +01:00
|
|
|
'config' => [
|
|
|
|
'type' => 'input',
|
|
|
|
'eval' => 'int',
|
|
|
|
'size' => 10,
|
|
|
|
'valuePicker' => [
|
|
|
|
'items' => [
|
|
|
|
[$languagePath . 'tx_abtest_cookie_time.cookie_1_month', 2419200],
|
|
|
|
[$languagePath . 'tx_abtest_cookie_time.cookie_1_week', 604800],
|
|
|
|
[$languagePath . 'tx_abtest_cookie_time.cookie_1_day', 86400],
|
|
|
|
[$languagePath . 'tx_abtest_cookie_time.cookie_12_days', 43200],
|
|
|
|
[$languagePath . 'tx_abtest_cookie_time.cookie_1_hour', 3600],
|
|
|
|
[$languagePath . 'tx_abtest_cookie_time.cookie_1_minute', 60],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'tx_abtest_counter' => [
|
|
|
|
'exclude' => 1,
|
|
|
|
'label' => $languagePath . 'tx_abtest_counter',
|
2023-03-06 14:39:21 +01:00
|
|
|
'description' => $languagePath . 'tx_abtest_counter.description',
|
2023-03-01 12:38:59 +01:00
|
|
|
'config' => [
|
|
|
|
'type' => 'input',
|
|
|
|
'eval' => 'int',
|
|
|
|
'size' => 10,
|
|
|
|
],
|
|
|
|
],
|
2023-03-06 14:39:21 +01:00
|
|
|
|
|
|
|
'tx_abtest_matomo_experiment_id' => [
|
|
|
|
'exclude' => 1,
|
|
|
|
'label' => $languagePath . 'tx_abtest_matomo_experiment_id',
|
|
|
|
'description' => $languagePath . 'tx_abtest_matomo_experiment_id.description',
|
|
|
|
'config' => [
|
|
|
|
'type' => 'input',
|
|
|
|
'eval' => 'nospace',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'tx_abtest_matomo_variant_id' => [
|
|
|
|
'exclude' => 1,
|
|
|
|
'label' => $languagePath . 'tx_abtest_matomo_variant_id',
|
|
|
|
'description' => $languagePath . 'tx_abtest_matomo_variant_id.description',
|
|
|
|
'config' => [
|
|
|
|
'type' => 'input',
|
|
|
|
'eval' => 'nospace',
|
|
|
|
'valuePicker' => [
|
|
|
|
'items' => [
|
|
|
|
[$languagePath . 'tx_abtest_matomo_variant_id.original', 'original'],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
2023-03-01 12:38:59 +01:00
|
|
|
]);
|
2017-12-10 22:19:30 +01:00
|
|
|
|
2023-03-06 14:39:21 +01:00
|
|
|
$GLOBALS['TCA'][$tableName]['palettes']['tx_abtest_matomo'] = [
|
|
|
|
'showitem' => 'tx_abtest_matomo_experiment_id, tx_abtest_matomo_variant_id',
|
|
|
|
];
|
|
|
|
|
2023-03-01 12:38:59 +01:00
|
|
|
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
|
|
|
|
$tableName,
|
2023-03-06 14:39:21 +01:00
|
|
|
implode(',', [
|
|
|
|
'--div--;' . $languagePath . 'div_title',
|
|
|
|
'tx_abtest_variant',
|
|
|
|
'tx_abtest_cookie_time',
|
|
|
|
'tx_abtest_counter',
|
|
|
|
'--palette--;' . $languagePath . 'palette_tx_abtest_matomo;tx_abtest_matomo',
|
|
|
|
]),
|
2023-03-01 12:38:59 +01:00
|
|
|
'',
|
|
|
|
'after:content_from_pid'
|
|
|
|
);
|
|
|
|
})();
|