[FEATURE] Adapt to new TCA and Form Engine API of TYPO3 CMS 7 73/43673/2
authorStanislas Rolland <typo3@sjbr.ca>
Wed, 30 Sep 2015 22:01:04 +0000 (18:01 -0400)
committerStanislas Rolland <typo3@sjbr.ca>
Wed, 30 Sep 2015 22:04:01 +0000 (00:04 +0200)
Resolves: #70239
Change-Id: I3604708509f28d3aedec7afdc518a24cc9d7f4e6
Reviewed-on: http://review.typo3.org/43673
Reviewed-by: Stanislas Rolland <typo3@sjbr.ca>
Tested-by: Stanislas Rolland <typo3@sjbr.ca>
16 files changed:
ChangeLog
Classes/Hook/Backend/Form/FormDataProvider/TcaLabelProcessor.php [new file with mode: 0644]
Classes/Hook/Backend/Form/FormDataProvider/TcaSelectItemsProcessor.php [new file with mode: 0644]
Classes/Hook/Backend/Form/Wizard/SuggestReceiver.php [new file with mode: 0644]
Configuration/TCA/Overrides/static_countries.php [new file with mode: 0644]
Configuration/TCA/Overrides/static_currencies.php [new file with mode: 0644]
Configuration/TCA/Overrides/static_languages.php [new file with mode: 0644]
Configuration/TCA/Overrides/static_territories.php [new file with mode: 0644]
Configuration/TCA/Overrides/sys_language.php [new file with mode: 0644]
Configuration/TCA/static_countries.php
Configuration/TCA/static_country_zones.php
Configuration/TCA/static_currencies.php
Configuration/TCA/static_languages.php
Configuration/TCA/static_territories.php
Configuration/TypoScript/Manager/setup.txt
ext_localconf.php

index 28b4687..e10d89a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@
        * Resolves #70228: Delete old language files
        * Resolves #70231: Delete translation files from extension
        * Resolves #70235: Move static template registration to TCA/Overrides
+       * Resolves #70239: Adapt to new TCA configuration and backend Form Engine API of TYPO3 CMS 7
 
 2015-09-14  Stanislas Rolland  <typo3@sjbr.ca>
 
diff --git a/Classes/Hook/Backend/Form/FormDataProvider/TcaLabelProcessor.php b/Classes/Hook/Backend/Form/FormDataProvider/TcaLabelProcessor.php
new file mode 100644 (file)
index 0000000..b874642
--- /dev/null
@@ -0,0 +1,111 @@
+<?php
+namespace SJBR\StaticInfoTables\Hook\Backend\Form\FormDataProvider;
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2013-2015 Stanislas Rolland <typo3(arobas)sjbr.ca>
+*  All rights reserved
+*
+*  This script is part of the Typo3 project. The Typo3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+/**
+ * Processor for TCA select items
+ */
+
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
+class TcaLabelProcessor {
+
+       /**
+        * Add ISO codes to the label of entities
+        *
+        * @param array $PA: parameters: items, config, TSconfig, table, row, field
+        * @param DataPreprocessor $fObj
+        * @return void
+        */
+       public function addIsoCodeToLabel (&$PA) {
+               $PA['title'] = $PA['row'][$GLOBALS['TCA'][$PA['table']]['ctrl']['label']];
+               if (TYPO3_MODE == 'BE') {
+                       /** @var $objectManager \TYPO3\CMS\Extbase\Object\ObjectManager */
+                       $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
+                       switch ($PA['table']) {
+                               case 'static_territories':
+                                       $isoCode = $PA['row']['tr_iso_nr'];
+                                       if (!$isoCode) {
+                                               /** @var $territoryRepository SJBR\StaticInfoTables\Domain\Repository\TerritoryRepository */
+                                               $territoryRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\TerritoryRepository');
+                                               /** @var $territory SJBR\StaticInfoTables\Domain\Model\Territory */
+                                               $territory = $territoryRepository->findByUid($PA['row']['uid']);
+                                               $isoCode = $territory->getUnCodeNumber();
+                                       }
+                                       if ($isoCode) {
+                                               $PA['title'] = $PA['title'] . ' (' . $isoCode . ')';
+                                       }
+                                       break;
+                               case 'static_countries':
+                                       $isoCode = $PA['row']['cn_iso_2'];
+                                       if (!$isoCode) {
+                                               /** @var $countryRepository SJBR\StaticInfoTables\Domain\Repository\CountryRepository */
+                                               $countryRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CountryRepository');
+                                               /** @var $country SJBR\StaticInfoTables\Domain\Model\Country */
+                                               $country = $countryRepository->findByUid($PA['row']['uid']);
+                                               $isoCode = $country->getIsoCodeA2();
+                                       }
+                                       if ($isoCode) {
+                                               $PA['title'] = $PA['title'] . ' (' . $isoCode . ')';
+                                       }
+                                       break;
+                               case 'static_languages':
+                                       $isoCodes = array($PA['row']['lg_iso_2']);
+                                       if ($PA['row']['lg_country_iso_2']) {
+                                               $isoCodes[] = $PA['row']['lg_country_iso_2'];
+                                       }
+                                       $isoCode = implode('_', $isoCodes);
+                                       if (!$isoCode || !$PA['row']['lg_country_iso_2']) {
+                                               /** @var $languageRepository SJBR\StaticInfoTables\Domain\Repository\LanguageRepository */
+                                               $languageRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\LanguageRepository');
+                                               /** @var $language SJBR\StaticInfoTables\Domain\Model\Language */
+                                               $language = $languageRepository->findByUid($PA['row']['uid']);
+                                               $isoCodes = array($language->getIsoCodeA2());
+                                               if ($language->getCountryIsoCodeA2()) {
+                                                       $isoCodes[] = $language->getCountryIsoCodeA2();
+                                               }
+                                               $isoCode = implode('_', $isoCodes);
+                                       }
+                                       if ($isoCode) {
+                                               $PA['title'] = $PA['title'] . ' (' . $isoCode . ')';
+                                       }
+                                       break;
+                               case 'static_currencies':
+                                       $isoCode = $PA['row']['cu_iso_3'];
+                                       if (!$isoCode) {
+                                               /** @var $currencyRepository SJBR\StaticInfoTables\Domain\Repository\CurrencyRepository */
+                                               $currencyRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CurrencyRepository');
+                                               /** @var $currency SJBR\StaticInfoTables\Domain\Model\Currency */
+                                               $currency = $currencyRepository->findByUid($PA['row']['uid']);
+                                               $isoCode = $currency->getIsoCodeA3();
+                                       }
+                                       if ($isoCode) {
+                                               $PA['title'] = $PA['title'] . ' (' . $isoCode . ')';
+                                       }
+                                       break;
+                               default:
+                                       break;
+                       }
+               }
+       }
+}
\ No newline at end of file
diff --git a/Classes/Hook/Backend/Form/FormDataProvider/TcaSelectItemsProcessor.php b/Classes/Hook/Backend/Form/FormDataProvider/TcaSelectItemsProcessor.php
new file mode 100644 (file)
index 0000000..1fc6d81
--- /dev/null
@@ -0,0 +1,237 @@
+<?php
+namespace SJBR\StaticInfoTables\Hook\Backend\Form\FormDataProvider;
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2013-2015 Stanislas Rolland <typo3(arobas)sjbr.ca>
+*  All rights reserved
+*
+*  This script is part of the Typo3 project. The Typo3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+/**
+ * Processor for TCA select items
+ */
+
+use SJBR\StaticInfoTables\Utility\ModelUtility;
+use SJBR\StaticInfoTables\Utility\TcaUtility;
+use SJBR\StaticInfoTables\Utility\LocalizationUtility;
+use TYPO3\CMS\Backend\Form\FormDataProvider\TcaSelectItems;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
+class TcaSelectItemsProcessor {
+
+       /**
+        * Translate and sort the territories selector using the current locale
+        *
+        * @param array $PA: parameters: items, config, TSconfig, table, row, field
+        * @param DataPreprocessor $fObj
+        * @return void
+        */
+       public function translateTerritoriesSelector($PA, TcaSelectItems $fObj) {
+               switch ($PA['table']) {
+                       case 'static_territories':
+                               // Avoid circular relation
+                               $row = $PA['row'];
+                               foreach ($PA['items'] as $index => $item) {
+                                       if ($item[1] == $row['uid']) {
+                                               unset($PA['items'][$index]);
+                                       }
+                               }
+                               break;
+               }
+               $PA['items'] = $this->translateSelectorItems($PA['items'], 'static_territories');
+               $PA['items'] = $this->replaceSelectorIndexField($PA);
+       }
+
+       /**
+        * Translate and sort the countries selector using the current locale
+        *
+        * @param array $PA: parameters: items, config, TSconfig, table, row, field
+        * @param DataPreprocessor $fObj
+        * @return void
+        */
+       public function translateCountriesSelector($PA, TcaSelectItems $fObj) {
+               $PA['items'] = $this->translateSelectorItems($PA['items'], 'static_countries');
+               $PA['items'] = $this->replaceSelectorIndexField($PA);
+       }
+
+       /**
+        * Translate and sort the country zones selector using the current locale
+        *
+        * @param array $PA: parameters: items, config, TSconfig, table, row, field
+        * @param DataPreprocessor $fObj
+        * @return void
+        */
+       public function translateCountryZonesSelector($PA, TcaSelectItems $fObj) {
+               $PA['items'] = $this->translateSelectorItems($PA['items'], 'static_country_zones');
+               $PA['items'] = $this->replaceSelectorIndexField($PA);
+       }
+
+       /**
+        * Translate and sort the currencies selector using the current locale
+        *
+        * @param array $PA: parameters: items, config, TSconfig, table, row, field
+        * @param DataPreprocessor $fObj
+        * @return void
+        */
+       public function translateCurrenciesSelector($PA, TcaSelectItems $fObj) {
+               $PA['items'] = $this->translateSelectorItems($PA['items'], 'static_currencies');
+               $PA['items'] = $this->replaceSelectorIndexField($PA);
+       }
+
+       /**
+        * Translate and sort the languages selector using the current locale
+        *
+        * @param array $PA: parameters: items, config, TSconfig, table, row, field
+        * @param DataPreprocessor $fObj
+        * @return void
+        */
+       public function translateLanguagesSelector($PA, TcaSelectItems $fObj) {
+
+               $PA['items'] = $this->translateSelectorItems($PA['items'], 'static_languages');
+               $PA['items'] = $this->replaceSelectorIndexField($PA);
+       }
+
+       /**
+        * Translate selector items array
+        *
+        * @param array $items: array of value/label pairs
+        * @param string $tableName: name of static info tables
+        * @return array array of value/translated label pairs
+        */
+       protected function translateSelectorItems($items, $tableName) {
+               $translatedItems = $items;
+               if (isset($translatedItems) && is_array($translatedItems)) {
+                       foreach ($translatedItems as $key => $item) {
+                               if ($translatedItems[$key][1]) {
+                                       //Get isocode if present
+                                       $code = strstr($item[0], '(');
+                                       $code2 = strstr(substr($code, 1), '(');
+                                       $code = $code2 ? $code2 : $code;
+                                       // Translate
+                                       $translatedItems[$key][0] = LocalizationUtility::translate(array('uid' => $item[1]), $tableName);
+                                       // Re-append isocode, if present
+                                       $translatedItems[$key][0] = $translatedItems[$key][0] . ($code ? ' ' . $code : '');
+                               }
+                       }
+                       $currentLocale = setlocale(LC_COLLATE, '0');
+                       $locale = LocalizationUtility::setCollatingLocale();
+                       if ($locale !== FALSE) {
+                               uasort($translatedItems, array($this, 'strcollOnLabels'));
+                       }
+                       setlocale(LC_COLLATE, $currentLocale);
+               }
+               $items = $translatedItems;
+               return $items;
+       }
+
+       /**
+        * Using strcoll comparison on labels
+        *
+        * @return integer see strcoll
+        */
+       protected function strcollOnLabels($itemA, $itemB) {
+               return strcoll($itemA[0], $itemB[0]);
+       }
+
+       /**
+        * Replace the selector's uid index with configured indexField
+        *
+        * @param array  $PA: TCA select field parameters array
+        * @return array The new $items array
+        */
+       protected function replaceSelectorIndexField($PA) {
+               $items = $PA['items'];
+               $indexFields = GeneralUtility::trimExplode(',', $PA['config']['itemsProcFunc_config']['indexField'], TRUE);
+               if (!empty($indexFields)) {
+                       $rows = array();
+                       // Collect items uid's
+                       $uids = array();
+                       foreach ($items as $key => $item) {
+                               if ($items[$key][1]) {
+                                       $uids[] = $item[1];
+                               }
+                       }
+                       $uidList = implode(',', $uids);
+                       if (!empty($uidList)) {
+                               /** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */
+                               $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
+                               switch ($PA['config']['foreign_table']) {
+                                       case 'static_territories':
+                                               /** @var $territoryRepository SJBR\StaticInfoTables\Domain\Repository\TerritoryRepository */
+                                               $territoryRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\TerritoryRepository');
+                                               $objects = $territoryRepository->findAllByUidInList($uidList)->toArray();
+                                               $columnsMapping = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Territory', ModelUtility::MAPPING_COLUMNS);
+                                               break;
+                                       case 'static_countries':
+                                               /** @var $countryRepository SJBR\StaticInfoTables\Domain\Repository\CountryRepository */
+                                               $countryRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CountryRepository');
+                                               $objects = $countryRepository->findAllByUidInList($uidList)->toArray();
+                                               $columnsMapping = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Country', ModelUtility::MAPPING_COLUMNS);
+                                               break;
+                                       case 'static_country_zones':
+                                               /** @var $countryZoneRepository SJBR\StaticInfoTables\Domain\Repository\CountryZoneRepository */
+                                               $countryZoneRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CountryZoneRepository');
+                                               $objects = $countryZoneRepository->findAllByUidInList($uidList)->toArray();
+                                               $columnsMapping = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\CountryZone', ModelUtility::MAPPING_COLUMNS);
+                                               break;                                  
+                                       case 'static_languages':
+                                               /** @var $languageRepository SJBR\StaticInfoTables\Domain\Repository\LanguageRepository */
+                                               $languageRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\LanguageRepository');
+                                               $objects = $languageRepository->findAllByUidInList($uidList)->toArray();
+                                               $columnsMapping = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Language', ModelUtility::MAPPING_COLUMNS);
+                                               break;
+                                       case 'static_currencies':
+                                               /** @var $currencyRepository SJBR\StaticInfoTables\Domain\Repository\CurrencyRepository */
+                                               $currencyRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CurrencyRepository');
+                                               $objects = $currencyRepository->findAllByUidInList($uidList)->toArray();
+                                               $columnsMapping = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Currency', ModelUtility::MAPPING_COLUMNS);
+                                               break;
+                                       default:
+                                               break;
+                               }
+                               if (!empty($objects)) {
+                                       // Map table column to object property
+                                       $indexProperties = array();
+                                       foreach ($indexFields as $indexField) {
+                                               if ($columnsMapping[$indexField]['mapOnProperty']) {
+                                                       $indexProperties[] = $columnsMapping[$indexField]['mapOnProperty'];
+                                               } else {
+                                                       $indexProperties[] = GeneralUtility::underscoredToUpperCamelCase($indexField);
+                                               }
+                                       }
+                                       // Index rows by uid
+                                       $uidIndexedRows = array();
+                                       foreach ($objects as $object) {
+                                               $uidIndexedObjects[$object->getUid()] = $object;
+                                       }
+                                       // Replace the items index field
+                                       foreach ($items as $key => $item) {
+                                               if ($items[$key][1]) {
+                                                       $object = $uidIndexedObjects[$items[$key][1]];
+                                                       $items[$key][1] = $object->_getProperty($indexProperties[0]);
+                                                       if ($indexFields[1] && $object->_getProperty($indexProperties[1])) {
+                                                               $items[$key][1] .=  '_' . $object->_getProperty($indexProperties[1]);
+                                                       }
+                                               }
+                                       }                                               
+                               }
+                       }
+               }
+               return $items;
+       }
+}
\ No newline at end of file
diff --git a/Classes/Hook/Backend/Form/Wizard/SuggestReceiver.php b/Classes/Hook/Backend/Form/Wizard/SuggestReceiver.php
new file mode 100644 (file)
index 0000000..0aa6b6d
--- /dev/null
@@ -0,0 +1,117 @@
+<?php
+namespace SJBR\StaticInfoTables\Hook\Backend\Form\Wizard;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2007-2011 Andreas Wolf <andreas.wolf@ikt-werk.de>
+ *  (c) 2013-2015 Stanislas Rolland <typo3(arobas)sjbr.ca>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+use SJBR\StaticInfoTables\Utility\LocalizationUtility;
+
+/**
+ * Default implementation of a handler class for an ajax record selector.
+ *
+ * Normally other implementations should be inherited from this one.
+ * queryTable() should not be overwritten under normal circumstances.
+ *
+ * @author Andreas Wolf <andreas.wolf@ikt-werk.de>
+ * @author Benjamin Mack <benni@typo3.org>
+ * @author Stanislas Rolland <typo3(arobas)sjbr.ca>
+ */
+class SuggestReceiver extends \TYPO3\CMS\Backend\Form\Wizard\SuggestWizardDefaultReceiver {
+
+       /**
+        * Prepare the statement for selecting the records which will be returned to the selector. May also return some
+        * other records (e.g. from a mm-table) which will be used later on to select the real records
+        *
+        * @return void
+        */
+       protected function prepareSelectStatement() {
+               $searchWholePhrase = $this->config['searchWholePhrase'];
+               $searchString = $this->params['value'];
+               $searchUid = intval($searchString);
+               if (strlen($searchString)) {
+                       $searchString = $GLOBALS['TYPO3_DB']->quoteStr($searchString, $this->table);
+                       $likeCondition = ' LIKE \'' . ($searchWholePhrase ? '%' : '') . $GLOBALS['TYPO3_DB']->escapeStrForLike($searchString, $this->table) . '%\'';
+                       // Get the label field for the current language, if any is available
+                       $lang = LocalizationUtility::getCurrentLanguage();
+                       $lang = LocalizationUtility::getIsoLanguageKey($lang);
+                       $labelFields = LocalizationUtility::getLabelFields($this->table, $lang);
+                       $selectFieldsList = $labelFields[0] . ',' . $this->config['additionalSearchFields'];
+                       $selectFields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $selectFieldsList, TRUE);
+                       $selectFields = array_unique($selectFields);
+                       $selectParts = array();
+                       foreach ($selectFields as $field) {
+                               $selectParts[] = $field . $likeCondition;
+                       }
+                       $this->selectClause = '(' . implode(' OR ', $selectParts) . ')';
+                       if ($searchUid > 0 && $searchUid == $searchString) {
+                               $this->selectClause = '(' . $this->selectClause . ' OR uid = ' . $searchUid . ')';
+                       }
+               }
+               if (isset($GLOBALS['TCA'][$this->table]['ctrl']['delete'])) {
+                       $this->selectClause .= ' AND ' . $GLOBALS['TCA'][$this->table]['ctrl']['delete'] . ' = 0';
+               }
+               if (count($this->allowedPages)) {
+                       $pidList = $GLOBALS['TYPO3_DB']->cleanIntArray($this->allowedPages);
+                       if (count($pidList)) {
+                               $this->selectClause .= ' AND pid IN (' . implode(', ', $pidList) . ') ';
+                       }
+               }
+               // add an additional search condition comment
+               if (isset($this->config['searchCondition']) && strlen($this->config['searchCondition']) > 0) {
+                       $this->selectClause .= ' AND ' . $this->config['searchCondition'];
+               }
+               // add the global clauses to the where-statement
+               $this->selectClause .= $this->addWhere;
+       }
+
+       /**
+        * Prepares the clause by which the result elements are sorted. See description of ORDER BY in
+        * SQL standard for reference.
+        *
+        * @return void
+        */
+       protected function prepareOrderByStatement() {
+               if ($GLOBALS['TCA'][$this->table]['ctrl']['label']) {
+                       $this->orderByStatement = $GLOBALS['TCA'][$this->table]['ctrl']['label'];
+               }
+               // Get the label field for the current language, if any is available
+               $lang = LocalizationUtility::getCurrentLanguage();
+               $lang = LocalizationUtility::getIsoLanguageKey($lang);
+               $labelFields = LocalizationUtility::getLabelFields($this->table, $lang);
+               $this->orderByStatement = implode(',' , $labelFields);
+       }
+
+       /**
+        * Manipulate a record before using it to render the selector; may be used to replace a MM-relation etc.
+        *
+        * @param array $row
+        */
+       protected function manipulateRecord(&$row) {
+               // Localize the record
+               $row[$GLOBALS['TCA'][$this->table]['ctrl']['label']] = LocalizationUtility::translate(array('uid' => $row['uid']), $this->table);
+       }
+}
\ No newline at end of file
diff --git a/Configuration/TCA/Overrides/static_countries.php b/Configuration/TCA/Overrides/static_countries.php
new file mode 100644 (file)
index 0000000..3e7a9e6
--- /dev/null
@@ -0,0 +1,9 @@
+<?php
+defined('TYPO3_MODE') or die();
+// Compatibility with 6.2
+if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getNumericTypo3Version()) < 7000000) {
+       $GLOBALS['TCA']['static_countries']['ctrl']['label_userFunc'] = 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\ElementRenderingHelper->addIsoCodeToLabel';
+       $GLOBALS['TCA']['static_countries']['columns']['cn_parent_territory_uid']['config']['itemsProcFunc'] = 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\ElementRenderingHelper->translateTerritoriesSelector';
+       $GLOBALS['TCA']['static_countries']['columns']['cn_currency_uid']['config']['itemsProcFunc'] = 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\ElementRenderingHelper->translateCurrenciesSelector';
+       $GLOBALS['TCA']['static_countries']['columns']['cn_currency_uid']['config']['wizards']['suggest']['default'] = array('receiverClass' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\SuggestReceiver');
+}
\ No newline at end of file
diff --git a/Configuration/TCA/Overrides/static_currencies.php b/Configuration/TCA/Overrides/static_currencies.php
new file mode 100644 (file)
index 0000000..957c3f0
--- /dev/null
@@ -0,0 +1,6 @@
+<?php
+defined('TYPO3_MODE') or die();
+// Compatibility with 6.2
+if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getNumericTypo3Version()) < 7000000) {
+       $GLOBALS['TCA']['static_currencies']['ctrl']['label_userFunc'] = 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\ElementRenderingHelper->addIsoCodeToLabel';
+}
\ No newline at end of file
diff --git a/Configuration/TCA/Overrides/static_languages.php b/Configuration/TCA/Overrides/static_languages.php
new file mode 100644 (file)
index 0000000..d5c0ef0
--- /dev/null
@@ -0,0 +1,6 @@
+<?php
+defined('TYPO3_MODE') or die();
+// Compatibility with 6.2
+if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getNumericTypo3Version()) < 7000000) {
+       $GLOBALS['TCA']['static_languages']['ctrl']['label_userFunc'] = 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\ElementRenderingHelper->addIsoCodeToLabel';
+}
\ No newline at end of file
diff --git a/Configuration/TCA/Overrides/static_territories.php b/Configuration/TCA/Overrides/static_territories.php
new file mode 100644 (file)
index 0000000..7e437ec
--- /dev/null
@@ -0,0 +1,7 @@
+<?php
+defined('TYPO3_MODE') or die();
+// Compatibility with 6.2
+if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getNumericTypo3Version()) < 7000000) {
+       $GLOBALS['TCA']['static_territories']['ctrl']['label_userFunc'] = 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\ElementRenderingHelper->addIsoCodeToLabel';
+       $GLOBALS['TCA']['static_territories']['columns']['tr_parent_territory_uid']['config']['itemsProcFunc'] = 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\ElementRenderingHelper->translateTerritoriesSelector';
+}
\ No newline at end of file
diff --git a/Configuration/TCA/Overrides/sys_language.php b/Configuration/TCA/Overrides/sys_language.php
new file mode 100644 (file)
index 0000000..9a53ebb
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+defined('TYPO3_MODE') or die();
+
+// Configure static_lang_isocode field in TCA
+$GLOBALS['TCA']['sys_language']['columns']['static_lang_isocode'] = array(
+       'exclude' => 1,
+       'label' => 'LLL:EXT:lang/locallang_tca.xlf:sys_language.isocode',
+       'displayCond' => 'EXT:static_info_tables:LOADED:true',
+       'config' => array(
+               'type' => 'select',
+               'items' => array(
+                       array('', 0)
+               ),
+               'foreign_table' => 'static_languages',
+               'foreign_table_where' => 'AND static_languages.pid=0 ORDER BY static_languages.lg_name_en',
+               'itemsProcFunc' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\FormDataProvider\\TcaSelectItemsProcessor->translateLanguagesSelector',
+               'noIconsBelowSelect' => 1,
+               'size' => 1,
+               'minitems' => 0,
+               'maxitems' => 1,
+               'wizards' => array(
+                       'suggest' => array(
+                               'type' => 'suggest',
+                               'default' => array(
+                                       'receiverClass' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\Wizard\\SuggestReceiver'
+                               )
+                       )
+               )
+       )
+);
+
+// Restore static_lang_isocode field in TCA
+if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getNumericTypo3Version()) >= 7000000) {
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('sys_language', 'static_lang_isocode', '', 'after:language_isocode');
+} else {
+       $GLOBALS['TCA']['sys_language']['columns']['static_lang_isocode']['config']['itemsProcFunc'] = 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\ElementRenderingHelper->translateLanguagesSelector';
+       $GLOBALS['TCA']['sys_language']['columns']['static_lang_isocode']['config']['wizards']['suggest']['default'] = array('receiverClass' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\SuggestReceiver');
+}
\ No newline at end of file
index 63a6865..8680eae 100644 (file)
@@ -5,7 +5,7 @@ return array(
                'label' => 'cn_short_en',
                'label_alt' => 'cn_iso_2',
                'label_alt_force' => 1,
-               'label_userFunc' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\ElementRenderingHelper->addIsoCodeToLabel',
+               'label_userFunc' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\FormDataProvider\\TcaLabelProcessor->addIsoCodeToLabel',
                'adminOnly' => 1,
                'rootLevel' => 1,
                'is_static' => 1,
@@ -13,7 +13,7 @@ return array(
                'default_sortby' => 'ORDER BY cn_short_en',
                'delete' => 'deleted',
                'title' => 'LLL:EXT:static_info_tables/Resources/Private/Language/locallang_db.xlf:static_countries.title',
-               'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('static_info_tables') . 'Resources/Public/Images/Icons/icon_static_countries.gif',
+               'iconfile' => 'EXT:static_info_tables/Resources/Public/Images/Icons/icon_static_countries.gif',
                'searchFields' => 'cn_short_en,cn_official_name_local,cn_official_name_en'
        ),
        'interface' => array(
@@ -70,7 +70,8 @@ return array(
                                ),
                                'foreign_table' => 'static_territories',
                                'foreign_table_where' => 'ORDER BY static_territories.tr_name_en',
-                               'itemsProcFunc' => 'SJBR\StaticInfoTables\Hook\Backend\Form\ElementRenderingHelper->translateTerritoriesSelector',
+                               'itemsProcFunc' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\FormDataProvider\\TcaSelectItemsProcessor->translateTerritoriesSelector',
+                               'noIconsBelowSelect' => 1,
                                'size' => 1,
                                'minitems' => 0,
                                'maxitems' => 1,
@@ -138,7 +139,8 @@ return array(
                                ),
                                'foreign_table' => 'static_currencies',
                                'foreign_table_where' => 'ORDER BY static_currencies.cu_name_en',
-                               'itemsProcFunc' => 'SJBR\StaticInfoTables\Hook\Backend\Form\ElementRenderingHelper->translateCurrenciesSelector',
+                               'itemsProcFunc' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\FormDataProvider\\TcaSelectItemsProcessor->translateCurrenciesSelector',
+                               'noIconsBelowSelect' => 1,
                                'size' => 1,
                                'minitems' => 0,
                                'maxitems' => 1,
@@ -146,7 +148,7 @@ return array(
                                        'suggest' => array(
                                                'type' => 'suggest',
                                                'default' => array(
-                                                       'receiverClass' => 'SJBR\StaticInfoTables\Hook\Backend\Form\SuggestReceiver'
+                                                       'receiverClass' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\Wizard\\SuggestReceiver'
                                                )
                                        )
                                )
index afa0e9f..ecbf6cc 100644 (file)
@@ -11,7 +11,7 @@ return array(
                'default_sortby' => 'ORDER BY zn_name_local',
                'delete' => 'deleted',
                'title' => 'LLL:EXT:static_info_tables/Resources/Private/Language/locallang_db.xlf:static_country_zones.title',
-               'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('static_info_tables') . 'Resources/Public/Images/Icons/icon_static_countries.gif',
+               'iconfile' => 'EXT:static_info_tables/Resources/Public/Images/Icons/icon_static_countries.gif',
                'searchFields' => 'zn_name_en,zn_name_local'
        ),
        'interface' => array(
index 8f20bec..b0619af 100644 (file)
@@ -5,7 +5,7 @@ return array(
                'label' => 'cu_name_en',
                'label_alt' => 'cu_iso_3',
                'label_alt_force' => 1,
-               'label_userFunc' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\ElementRenderingHelper->addIsoCodeToLabel',
+               'label_userFunc' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\FormDataProvider\\TcaLabelProcessor->addIsoCodeToLabel',
                'adminOnly' => 1,
                'rootLevel' => 1,
                'is_static' => 1,
@@ -13,7 +13,7 @@ return array(
                'default_sortby' => 'ORDER BY cu_name_en',
                'delete' => 'deleted',
                'title' => 'LLL:EXT:static_info_tables/Resources/Private/Language/locallang_db.xlf:static_currencies.title',
-               'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('static_info_tables') . 'Resources/Public/Images/Icons/icon_static_currencies.gif',
+               'iconfile' => 'EXT:static_info_tables/Resources/Public/Images/Icons/icon_static_currencies.gif',
                'searchFields' => 'cu_name_en'
        ),
        'interface' => array(
index e867c63..3916698 100644 (file)
@@ -5,7 +5,7 @@ return array(
                'label' => 'lg_name_en',
                'label_alt' => 'lg_iso_2',
                'label_alt_force' => 1,
-               'label_userFunc' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\ElementRenderingHelper->addIsoCodeToLabel',
+               'label_userFunc' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\FormDataProvider\\TcaLabelProcessor->addIsoCodeToLabel',
                'adminOnly' => 1,
                'rootLevel' => 1,
                'is_static' => 1,
@@ -13,7 +13,7 @@ return array(
                'default_sortby' => 'ORDER BY lg_name_en',
                'delete' => 'deleted',
                'title' => 'LLL:EXT:static_info_tables/Resources/Private/Language/locallang_db.xlf:static_languages.title',
-               'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('static_info_tables') . 'Resources/Public/Images/Icons/icon_static_languages.gif',
+               'iconfile' => 'EXT:static_info_tables/Resources/Public/Images/Icons/icon_static_languages.gif',
                'searchFields' => 'lg_name_en,lg_name_local'
        ),
        'interface' => array(
index 4cac8ac..04da1d3 100644 (file)
@@ -5,7 +5,7 @@ return array(
                'label' => 'tr_name_en',
                'label_alt' => 'tr_iso_nr',
                'label_alt_force' => 1,
-               'label_userFunc' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\ElementRenderingHelper->addIsoCodeToLabel',
+               'label_userFunc' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\FormDataProvider\\TcaLabelProcessor->addIsoCodeToLabel',
                'adminOnly' => 1,
                'rootLevel' => 1,
                'is_static' => 1,
@@ -13,7 +13,7 @@ return array(
                'default_sortby' => 'ORDER BY tr_name_en',
                'delete' => 'deleted',
                'title' => 'LLL:EXT:static_info_tables/Resources/Private/Language/locallang_db.xlf:static_territories.title',
-               'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('static_info_tables') . 'Resources/Public/Images/Icons/icon_static_territories.gif',
+               'iconfile' => 'EXT:static_info_tables/Resources/Public/Images/Icons/icon_static_territories.gif',
                'searchFields' => 'tr_name_en'
        ),
        'interface' => array(
@@ -48,7 +48,8 @@ return array(
                                ),
                                'foreign_table' => 'static_territories',
                                'foreign_table_where' => 'ORDER BY static_territories.tr_name_en',
-                               'itemsProcFunc' => 'SJBR\StaticInfoTables\Hook\Backend\Form\ElementRenderingHelper->translateTerritoriesSelector',
+                               'itemsProcFunc' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\FormDataProvider\\TcaSelectItemsProcessor->translateTerritoriesSelector',
+                               'noIconsBelowSelect' => 1,
                                'size' => 1,
                                'minitems' => 0,
                                'maxitems' => 1,
index 495ec28..088764a 100644 (file)
@@ -1,10 +1,9 @@
 ## Configuring the Static Info Manager backend module
 module.tx_staticinfotables {
-       features.rewrittenPropertyMapper = 1
        ## Paths for Manager templates
        view {
-               templateRootPath = EXT:static_info_tables/Resources/Private/Templates/
-               partialRootPath = EXT:static_info_tables/Resources/Private/Partials/
-               layoutRootPath = EXT:static_info_tables/Resources/Private/Layouts/
+               templateRootPaths.0 = EXT:static_info_tables/Resources/Private/Templates/
+               partialRootPaths.0 = EXT:static_info_tables/Resources/Private/Partials/
+               layoutRootPaths.0 = EXT:static_info_tables/Resources/Private/Layouts/
        }
 }
\ No newline at end of file
index 1bbc145..6ccd38b 100644 (file)
@@ -1,7 +1,5 @@
 <?php
-if (!defined ('TYPO3_MODE')) {
-       die ('Access denied.');
-}
+defined('TYPO3_MODE') or die();
 
 if (!defined ('STATIC_INFO_TABLES_EXTkey')) {
        define('STATIC_INFO_TABLES_EXTkey', $_EXTKEY);
@@ -33,7 +31,7 @@ if (!isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][
 }
 
 // Configure clear cache post processing for extended domain model
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc'][$_EXTKEY] = 'EXT:' . $_EXTKEY . '/Classes/Cache/ClassCacheManager.php:SJBR\StaticInfoTables\Cache\ClassCacheManager->reBuild';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc'][$_EXTKEY] = 'SJBR\\StaticInfoTables\\Cache\\ClassCacheManager->reBuild';
 
 // Names of static entities
 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['entities'] = array(
@@ -99,8 +97,10 @@ if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['tables']) && is_arra
 }
 unset($labelTable);
 
-// Registering backend form select field prrenderingfor hook in order to localize selected items
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getSingleFieldClass'][] = 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\ElementRenderingHelper';
+// Registering backend form select field pre-rendering hook in order to localize selected items
+if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) < 7000000) {
+       $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getSingleFieldClass'][] = 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\ElementRenderingHelper';
+}
 
 // Add data handling hook to manage ISO codes redundancies on records
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = 'SJBR\\StaticInfoTables\\Hook\\Core\\DataHandling\\ProcessDataMap';