/** * looks for tt_address records with changes to the first, middle, and * last name fields to come by. This function will then write changes back * to the old combined name field in a configurable format * * @param string $status action status: new/update is relevant for us * @param string $table db table * @param int $id record uid * @param array $fieldArray record * @param object $pObj parent object * @return void */ public function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray, $pObj) { if ($table == 'tt_address' && ($status == 'new' || $status == 'update')) { $settings = SettingsUtility::getSettings(); if ($settings->isStoreBackwardsCompatName()) { if ($status == 'update') { $address = $this->getFullRecord($id); } else { $address = $fieldArray; } $format = $settings->getBackwardsCompatFormat(); $newRecord = array_merge($address, $fieldArray); $combinedName = trim(sprintf($format, $newRecord['first_name'], $newRecord['middle_name'], $newRecord['last_name'])); if (!empty($combinedName)) { $fieldArray['name'] = $combinedName; } } } }
<?php defined('TYPO3_MODE') or die; \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig(' options.saveDocNew.tt_address_group = 1 options.saveDocNew.tt_address = 1 '); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPItoST43($_EXTKEY, 'pi1/class.tx_ttaddress_pi1.php', '_pi1', 'list_type', 1); if (TYPO3_MODE === 'BE') { $settings = \TYPO3\TtAddress\Utility\SettingsUtility::getSettings(); if ($settings->isStoreBackwardsCompatName()) { $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = 'TYPO3\\TtAddress\\Hooks\\DataHandler\\BackwardsCompatibilityNameFormat'; } } // Update scripts $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['tt_address_group'] = 'TYPO3\\TtAddress\\Updates\\AddressGroupToSysCategory';