[TASK] Move config.beLoginLinkIPList to compat7
[Packages/TYPO3.CMS.git] / typo3 / sysext / compatibility7 / Classes / Hooks / TcaSoftExcludeHook.php
1 <?php
2 namespace TYPO3\CMS\Compatibility7\Hooks;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use TYPO3\CMS\Core\Utility\GeneralUtility;
18 use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
19
20 /**
21 * Hook to validate the TypoScript option
22 * config.sys_language_softExclude
23 * that allows to set certain table/field combinations to use l10n_mode=exclude which have not set to l10n_mode
24 * by default.
25 *
26 * This option is mostly obsolete with TYPO3 v8 as the database sets for translation modes are handled via
27 * "allowLanguageSynchronization" where all fields are properly filled in all translations
28 */
29 class TcaSoftExcludeHook
30 {
31 /**
32 * Hooks in TSFE after the language initialization to set TCA l10n_mode=exclude on certain fields
33 * on runtime, called "softExclude"
34 *
35 * @param array $parameters left empty, not in use
36 * @param TypoScriptFrontendController $parentObject
37 */
38 public function setCustomExcludeFields(array $parameters, TypoScriptFrontendController $parentObject)
39 {
40 if (isset($parentObject->config['config']['sys_language_softExclude'])
41 && !empty($parentObject->config['config']['sys_language_softExclude'])) {
42 $tableFieldCombinations = GeneralUtility::trimExplode(',', $parentObject->config['config']['sys_language_softExclude'], true);
43 foreach ($tableFieldCombinations as $tableFieldCombination) {
44 list($tableName, $fieldName) = explode(':', $tableFieldCombination);
45 $GLOBALS['TCA'][$tableName]['columns'][$fieldName]['l10n_mode'] = 'exclude';
46 }
47 }
48 }
49 }