[FEATURE] Provide API to add cached TCA changes 84/29484/6
authorHelmut Hummel <helmut.hummel@typo3.org>
Tue, 15 Apr 2014 10:55:37 +0000 (12:55 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Tue, 15 Apr 2014 16:30:21 +0000 (18:30 +0200)
This change adds the feature that php files in the
extension directory Configuration/TCA/Overrides/
will be executed right before building the cached
TCA. These files must *only* contain PHP code
that manipulate TCA (like addTCAColumns or
addToAllTCATypes).

The benefit in doing so is that we can move all code
manipulating the TCA that previously was in ext_tables.php
and therefore uncachable, can now be in a defined
location and is only executed when TCA is built
and after that cached.

This will give backend requests quite a performance
boost once extensions start using these files.

Category Registry changes will also be applied
after Configuration/TCA/Overrides/ has been processed
so that makeCategorizable calls can now also happen
in files in this locations and do not need to stay
in ext_localconf.php where they also would be executed
on every request.

For now only filemetadata extension TCA configuration
is moved. All other core extensions will follow later.

Resolves: #57942
Documentation: #57951
Releases: 6.2
Change-Id: Id7fdebac266bc0b4e85a45b64d73e4f4f3c59a36
Reviewed-on: https://review.typo3.org/29484
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/core/Classes/Category/CategoryRegistry.php
typo3/sysext/core/Classes/Configuration/TcaBuildingAspect.php [new file with mode: 0644]
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/core/Classes/Package/PackageManager.php
typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php
typo3/sysext/core/ext_localconf.php
typo3/sysext/filemetadata/Configuration/TCA/Overrides/sys_file_metadata.php [new file with mode: 0644]
typo3/sysext/filemetadata/Configuration/TCA/sys_file_metadata.php [deleted file]

index cf80f37..22e3d24 100644 (file)
@@ -220,6 +220,7 @@ class CategoryRegistry implements \TYPO3\CMS\Core\SingletonInterface {
         * Apply TCA to all registered tables
         *
         * @return void
+        * @internal
         */
        public function applyTca() {
 
@@ -396,6 +397,7 @@ class CategoryRegistry implements \TYPO3\CMS\Core\SingletonInterface {
         * @return array
         */
        public function addCategoryDatabaseSchemaToTablesDefinition(array $sqlString) {
+               $this->registerDefaultCategorizedTables();
                $sqlString[] = $this->getDatabaseTableDefinitions();
                return array('sqlString' => $sqlString);
        }
diff --git a/typo3/sysext/core/Classes/Configuration/TcaBuildingAspect.php b/typo3/sysext/core/Classes/Configuration/TcaBuildingAspect.php
new file mode 100644 (file)
index 0000000..e20a396
--- /dev/null
@@ -0,0 +1,77 @@
+<?php
+namespace TYPO3\CMS\Core\Configuration;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2014 Helmut Hummel <helmut.hummel@typo3.org>
+ *  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 text file 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!
+ ***************************************************************/
+
+/**
+ * Assembles TCA overrides from packages to build the final TCA
+ */
+class TcaBuildingAspect {
+
+       const TCA_OVERRIDES_PATH = 'Configuration/TCA/Overrides';
+
+       /**
+        * @var \TYPO3\CMS\Core\Package\PackageManager
+        * @inject
+        */
+       protected $packageManager;
+
+       /**
+        * @var \TYPO3\CMS\Core\Category\CategoryRegistry
+        * @inject
+        */
+       protected $categoryRegistry;
+
+       /**
+        * Scans active packages for TCA override code and executes it.
+        * Also applies category registry changes after that, so that
+        * registering calls to the registry can be (and should be) in TCA override files.
+        *
+        * @return array
+        */
+       public function applyTcaOverrides() {
+               foreach ($this->packageManager->getActivePackages() as $package) {
+                       $tcaOverridesPathForPackage = $package->getPackagePath() . self::TCA_OVERRIDES_PATH;
+                       if (is_dir($tcaOverridesPathForPackage)) {
+                               $files = scandir($tcaOverridesPathForPackage);
+                               foreach ($files as $file) {
+                                       if (
+                                               is_file($tcaOverridesPathForPackage . '/' . $file)
+                                               && ($file !== '.')
+                                               && ($file !== '..')
+                                               && (substr($file, -4, 4) === '.php')
+                                       ) {
+                                               require($tcaOverridesPathForPackage . '/' . $file);
+                                       }
+                               }
+                       }
+
+               }
+               $this->categoryRegistry->applyTca();
+               return array($GLOBALS['TCA']);
+       }
+}
\ No newline at end of file
index 056eac6..729bbb7 100644 (file)
@@ -946,9 +946,6 @@ class Bootstrap {
                if (file_exists($extTablesFile) && is_file($extTablesFile)) {
                        include $extTablesFile;
                }
-
-               // Apply TCA onto tables to be categorized
-               \TYPO3\CMS\Core\Category\CategoryRegistry::getInstance()->applyTca();
        }
 
        /**
index 8d8552b..f2ee65c 100644 (file)
@@ -680,7 +680,7 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
         * A package is active, if it is available and has been activated in the package
         * manager settings. This method returns runtime activated packages too
         *
-        * @return array Array of \TYPO3\Flow\Package\PackageInterface
+        * @return \TYPO3\Flow\Package\PackageInterface[]
         * @api
         */
        public function getActivePackages() {
index 35d74de..af590ca 100644 (file)
@@ -251,7 +251,7 @@ class ExtensionManagementUtility {
         * Adds an array with $GLOBALS['TCA'] column-configuration to the $GLOBALS['TCA']-entry for that table.
         * This function adds the configuration needed for rendering of the field in TCEFORMS - but it does NOT add the field names to the types lists!
         * So to have the fields displayed you must also call fx. addToAllTCAtypes or manually add the fields to the types list.
-        * FOR USE IN ext_tables.php FILES
+        * FOR USE IN ext_tables.php FILES or files in Configuration/TCA/Overrides/*.php Use the latter to benefit from TCA caching!
         *
         * @param string $table The table name of a table already present in $GLOBALS['TCA'] with a columns section
         * @param array $columnArray The array with the additional columns (typical some fields an extension wants to add)
@@ -276,7 +276,7 @@ class ExtensionManagementUtility {
         * Adds a string $string (comma separated list of field names) to all ["types"][xxx]["showitem"] entries for table $table (unless limited by $typeList)
         * This is needed to have new fields shown automatically in the TCEFORMS of a record from $table.
         * Typically this function is called after having added new columns (database fields) with the addTCAcolumns function
-        * FOR USE IN ext_tables.php FILES
+        * FOR USE IN ext_tables.php FILES or files in Configuration/TCA/Overrides/*.php Use the latter to benefit from TCA caching!
         *
         * @param string $table Table name
         * @param string $newFieldsString Field list to add.
@@ -1243,7 +1243,7 @@ class ExtensionManagementUtility {
         * Takes the $itemArray (label, value[,icon]) and adds to the items-array of $GLOBALS['TCA'][tt_content] elements with CType "listtype" (or another field if $type points to another fieldname)
         * If the value (array pos. 1) is already found in that items-array, the entry is substituted, otherwise the input array is added to the bottom.
         * Use this function to add a frontend plugin to this list of plugin-types - or more generally use this function to add an entry to any selectorbox/radio-button set in the TCEFORMS
-        * FOR USE IN ext_tables.php FILES
+        * FOR USE IN ext_tables.php FILES or files in Configuration/TCA/Overrides/*.php Use the latter to benefit from TCA caching!
         *
         * @param array $itemArray Item Array
         * @param string $type Type (eg. "list_type") - basically a field from "tt_content" table
@@ -1284,7 +1284,7 @@ class ExtensionManagementUtility {
        /**
         * Adds the $table tablename to the list of tables allowed to be includes by content element type "Insert records"
         * By using $content_table and $content_field you can also use the function for other tables.
-        * FOR USE IN ext_tables.php FILES
+        * FOR USE IN ext_tables.php FILES or files in Configuration/TCA/Overrides/*.php Use the latter to benefit from TCA caching!
         *
         * @param string $table Table name to allow for "insert record
         * @param string $content_table Table name TO WHICH the $table name is applied. See $content_field as well.
@@ -1368,7 +1368,7 @@ tt_content.' . $key . $prefix . ' {
 
        /**
         * Call this method to add an entry in the static template list found in sys_templates
-        * FOR USE IN ext_tables.php FILES
+        * FOR USE IN ext_tables.php FILES or files in Configuration/TCA/Overrides/*.php Use the latter to benefit from TCA caching!
         *
         * @param string $extKey Is of course the extension key
         * @param string $path Is the path where the template files (fixed names) include_static.txt (integer list of uids from the table "static_templates"), constants.txt, setup.txt, and include_static_file.txt is found (relative to extPath, eg. 'static/'). The file include_static_file.txt, allows you to include other static templates defined in files, from your static template, and thus corresponds to the field 'include_static_file' in the sys_template table. The syntax for this is a comma separated list of static templates to include, like:  EXT:css_styled_content/static/,EXT:da_newsletter_subscription/static/,EXT:cc_random_image/pi2/static/
@@ -1913,7 +1913,7 @@ tt_content.' . $key . $prefix . ' {
         *
         * @TODO: This method should be protected, but with current em it is hard to do so,
         * @TODO: Find out if we may remove this already
-        * @param array Extension array to load, loader order is kept
+        * @param array $newExtensionList Extension array to load, loader order is kept
         * @return void
         * @internal
         * @deprecated since 6.2, will be removed two versions later
@@ -1924,6 +1924,7 @@ tt_content.' . $key . $prefix . ' {
 
        /**
         * Makes a table categorizable by adding value into the category registry.
+        * FOR USE IN ext_localconf.php FILES or files in Configuration/TCA/Overrides/*.php Use the latter to benefit from TCA caching!
         *
         * @param string $extensionKey Extension key to be used
         * @param string $tableName Name of the table to be categorized
@@ -1944,5 +1945,4 @@ tt_content.' . $key . $prefix . ' {
                        );
                }
        }
-
 }
index 60243c5..29f2b60 100644 (file)
@@ -2,15 +2,17 @@
 if (!defined('TYPO3_MODE')) {
        die('Access denied.');
 }
+/** @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher */
+$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher');
 
 if (TYPO3_MODE === 'BE' && !(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_INSTALL)) {
-       \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher')->connect(
+       $signalSlotDispatcher->connect(
                'TYPO3\\CMS\\Core\\Resource\\ResourceFactory',
                \TYPO3\CMS\Core\Resource\ResourceFactoryInterface::SIGNAL_PostProcessStorage,
                'TYPO3\\CMS\\Core\\Resource\\Security\\StoragePermissionsAspect',
                'addUserPermissionsToStorage'
        );
-       \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher')->connect(
+       $signalSlotDispatcher->connect(
                'PackageManagement',
                'packagesMayHaveChanged',
                'TYPO3\\CMS\\Core\\Package\\PackageManager',
@@ -18,11 +20,20 @@ if (TYPO3_MODE === 'BE' && !(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_INSTALL)) {
        );
 }
 
-\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher')->connect(
+$signalSlotDispatcher->connect(
        'TYPO3\\CMS\\Core\\Resource\\ResourceStorage',
        \TYPO3\CMS\Core\Resource\ResourceStorageInterface::SIGNAL_PostFileDelete,
        'TYPO3\\CMS\\Core\\Resource\\Processing\\FileDeletionAspect',
        'removeFromRepository'
 );
 
+$signalSlotDispatcher->connect(
+       'TYPO3\\CMS\\Core\\Utility\\ExtensionManagementUtility',
+       'tcaIsBeingBuilt',
+       'TYPO3\\CMS\\Core\\Configuration\\TcaBuildingAspect',
+       'applyTcaOverrides'
+);
+
+unset($signalSlotDispatcher);
+
 $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['dumpFile'] = 'EXT:core/Resources/PHP/FileDumpEID.php';
diff --git a/typo3/sysext/filemetadata/Configuration/TCA/Overrides/sys_file_metadata.php b/typo3/sysext/filemetadata/Configuration/TCA/Overrides/sys_file_metadata.php
new file mode 100644 (file)
index 0000000..c57248c
--- /dev/null
@@ -0,0 +1,442 @@
+<?php
+
+$tca = array(
+       'ctrl' => array(
+               'type' => 'file:type',
+       ),
+       'types' => array(
+               TYPO3\CMS\Core\Resource\File::FILETYPE_UNKNOWN => array('showitem' => '
+                                                               fileinfo, title, description, alternative, keywords, caption, download_name,
+
+                                                               --div--;LLL:EXT:cms/locallang_ttc.xml:tabs.access,
+                                                                       --palette--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:palette.visibility;10;; ,
+                                                                       fe_groups,
+
+                                                               --div--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:tabs.metadata,
+                                                                       creator, --palette--;;20;;,
+                                                                       --palette--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:palette.geo_location;40;;'),
+
+               TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => array('showitem' => '
+                                                               fileinfo, title, description, alternative, keywords, caption, download_name,
+
+                                                               --div--;LLL:EXT:cms/locallang_ttc.xml:tabs.access,
+                                                                       --palette--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:palette.visibility;10;; ,
+                                                                       fe_groups,
+
+                                                               --div--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:tabs.metadata,
+                                                                       creator, --palette--;;20;;,
+                                                                       --palette--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:palette.geo_location;40;;,
+                                                                       language'),
+
+               TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => array('showitem' => '
+                                                               fileinfo, title, description, alternative, keywords, caption, download_name,
+
+                                                               --div--;LLL:EXT:cms/locallang_ttc.xml:tabs.access,
+                                                                       --palette--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:palette.visibility;10;; ,
+                                                                       fe_groups,
+
+                                                               --div--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:tabs.metadata,
+                                                                       creator, --palette--;;20;;,
+                                                                       --palette--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:palette.geo_location;40;; ,
+                                                                       --palette--;;30;;,
+                                                                       --palette--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:palette.metrics;50;;'),
+
+               TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => array('showitem' => '
+
+                                                               fileinfo, title, description, alternative, keywords, caption, download_name,
+
+                                                               --div--;LLL:EXT:cms/locallang_ttc.xml:tabs.access,
+                                                                       --palette--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:palette.visibility;10;; ,
+                                                                       fe_groups,
+
+                                                               --div--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:tabs.metadata,
+                                                                       duration,
+                                                                       creator, --palette--;;20;;, language'),
+
+               TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => array('showitem' => '
+                                                               fileinfo, title, description, alternative, keywords, caption, download_name,
+
+                                                               --div--;LLL:EXT:cms/locallang_ttc.xml:tabs.access,
+                                                                       --palette--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:palette.visibility;10;; ,
+                                                                       fe_groups,
+
+                                                               --div--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:tabs.metadata,
+                                                                       duration,
+                                                                       creator, --palette--;;20;;, language'),
+
+               TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => array('showitem' => '
+                                                               fileinfo, title, description, alternative, keywords, caption, download_name,
+
+                                                               --div--;LLL:EXT:cms/locallang_ttc.xml:tabs.access,
+                                                                       --palette--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:palette.visibility;10;; ,
+                                                                       fe_groups,
+
+                                                               --div--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:tabs.metadata,
+                                                                       creator, --palette--;;20;;,
+                                                                       --palette--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:palette.geo_location;40;; ,
+                                                                       language, --palette--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:palette.content_date;60;;, pages'),
+       ),
+       'palettes' => array(
+               '10' => array('showitem' => 'visible, status, ranking', 'canNotCollapse' => '1'),
+               '20' => array('showitem' => 'creator_tool, publisher, source', 'canNotCollapse' => '1'),
+               '30' => array('showitem' => 'latitude, longitude', 'canNotCollapse' => '1'),
+               '40' => array('showitem' => 'location_country, location_region, location_city', 'canNotCollapse' => '1'),
+               '50' => array('showitem' => 'width, height, unit, color_space', 'canNotCollapse' => '1'),
+               '60' => array('showitem' => 'content_creation_date, content_modification_date', 'canNotCollapse' => '1'),
+       ),
+       'columns' => array(
+               'visible' => array(
+                       'exclude' => 1,
+                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.visible',
+                       'config' => array(
+                               'type' => 'check',
+                               'default' => '1'
+                       ),
+               ),
+               'status' => array(
+                       'exclude' => 1,
+                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.status',
+                       'config' => array(
+                               'type' => 'select',
+                               'items' => array(
+                                       array(
+                                               'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.status.1',
+                                               1,
+                                               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('filemetadata') . 'Resources/Public/Icons/status_1.png'
+                                       ),
+                                       array(
+                                               'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.status.2',
+                                               2,
+                                               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('filemetadata') . 'Resources/Public/Icons/status_2.png'
+                                       ),
+                                       array(
+                                               'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.status.3',
+                                               3,
+                                               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('filemetadata') . 'Resources/Public/Icons/status_3.png'
+                                       ),
+                               ),
+                       ),
+               ),
+               'keywords' => array(
+                       'exclude' => 1,
+                       'l10n_mode' => 'prefixLangTitle',
+                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.keywords',
+                       'config' => array(
+                               'placeholder' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:placeholder.keywords',
+                               'type' => 'input',
+                               'size' => 255,
+                               'eval' => 'trim'
+                       ),
+               ),
+               'caption' => array(
+                       'exclude' => 1,
+                       'l10n_mode' => 'prefixLangTitle',
+                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.caption',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => 30,
+                               'eval' => 'trim'
+                       ),
+               ),
+               'creator_tool' => array(
+                       'exclude' => 1,
+                       'l10n_mode' => 'exclude',
+                       'l10n_display' => 'defaultAsReadonly',
+                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.creator_tool',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => 20,
+                               'eval' => 'trim'
+                       ),
+               ),
+               'download_name' => array(
+                       'exclude' => 1,
+                       'l10n_mode' => 'exclude',
+                       'l10n_display' => 'defaultAsReadonly',
+                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.download_name',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => 30,
+                               'eval' => 'trim'
+                       ),
+               ),
+               'creator' => array(
+                       'exclude' => 1,
+                       'l10n_mode' => 'exclude',
+                       'l10n_display' => 'defaultAsReadonly',
+                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.creator',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => 30,
+                               'eval' => 'trim'
+                       ),
+               ),
+               'publisher' => array(
+                       'exclude' => 1,
+                       'l10n_mode' => 'exclude',
+                       'l10n_display' => 'defaultAsReadonly',
+                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.publisher',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => 20,
+                               'eval' => 'trim'
+                       ),
+               ),
+               'source' => array(
+                       'exclude' => 1,
+                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.source',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => 20,
+                               'eval' => 'trim'
+                       ),
+               ),
+               'location_country' => array(
+                       'exclude' => 1,
+                       'l10n_mode' => 'mergeIfNotBlank',
+                       'l10n_display' => '',
+                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.location_country',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => 20,
+                               'eval' => 'trim'
+                       ),
+               ),
+               'location_region' => array(
+                       'exclude' => 1,
+                       'l10n_mode' => 'mergeIfNotBlank',
+                       'l10n_display' => '',
+                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.location_region',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => 20,
+                               'eval' => 'trim'
+                       ),
+               ),
+               'location_city' => array(
+                       'exclude' => 1,
+                       'l10n_mode' => 'mergeIfNotBlank',
+                       'l10n_display' => '',
+                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.location_city',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => 20,
+                               'eval' => 'trim'
+                       ),
+               ),
+               'latitude' => array(
+                       'exclude' => 1,
+                       'l10n_mode' => 'exclude',
+                       'l10n_display' => 'defaultAsReadonly',
+                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.latitude',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => '20',
+                               'eval' => 'trim',
+                               'max' => '30',
+                               'default' => '0.00000000000000'
+                       ),
+               ),
+               'longitude' => array(
+                       'exclude' => 1,
+                       'l10n_mode' => 'exclude',
+                       'l10n_display' => 'defaultAsReadonly',
+                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.longitude',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => '20',
+                               'eval' => 'trim',
+                               'max' => '30',
+                               'default' => '0.00000000000000'
+                       ),
+               ),
+               'ranking' => array(
+                       'exclude' => 1,
+                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.ranking',
+                       'config' => array(
+                               'type' => 'select',
+                               'minitems' => 1,
+                               'maxitems' => 1,
+                               'items' => array(
+                                       array(1, 1),
+                                       array(2, 2),
+                                       array(3, 3),
+                                       array(4, 4),
+                                       array(5, 5),
+                               ),
+                       ),
+               ),
+               'content_creation_date' => array(
+                       'exclude' => 1,
+                       'l10n_mode' => 'exclude',
+                       'l10n_display' => 'defaultAsReadonly',
+                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.content_creation_date',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => 12,
+                               'max' => 20,
+                               'eval' => 'date',
+                               'checkbox' => 1,
+                               'default' => time()
+                       ),
+               ),
+               'content_modification_date' => array(
+                       'exclude' => 1,
+                       'l10n_mode' => 'exclude',
+                       'l10n_display' => 'defaultAsReadonly',
+                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.content_modification_date',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => 12,
+                               'max' => 20,
+                               'eval' => 'date',
+                               'checkbox' => 1,
+                               'default' => time()
+                       ),
+               ),
+               'note' => array(
+                       'exclude' => 1,
+                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.note',
+                       'config' => array(
+                               'type' => 'text',
+                               'cols' => 40,
+                               'rows' => 15,
+                               'eval' => 'trim'
+                       ),
+               ),
+               /*
+                * METRICS ###########################################
+                */
+               'unit' => array(
+                       'exclude' => 1,
+                       'l10n_mode' => 'exclude',
+                       'l10n_display' => 'defaultAsReadonly',
+                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.unit',
+                       'config' => array(
+                               'type' => 'select',
+                               'items' => array(
+                                       array('', ''),
+                                       array('px', 'px'),
+                                       array('mm', 'mm'),
+                                       array('cm', 'cm'),
+                                       array('m', 'm'),
+                                       array('p', 'p'),
+                               ),
+                               'default' => '',
+                               'readOnly' => TRUE,
+                       ),
+               ),
+               'duration' => array(
+                       'exclude' => 1,
+                       'l10n_mode' => 'exclude',
+                       'l10n_display' => 'defaultAsReadonly',
+                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.duration',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => '10',
+                               'max' => '20',
+                               'eval' => 'int',
+                               'default' => '0'
+                       )
+               ),
+               'color_space' => array(
+                       'exclude' => 1,
+                       'l10n_mode' => 'exclude',
+                       'l10n_display' => 'defaultAsReadonly',
+                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.color_space',
+                       'config' => array(
+                               'type' => 'select',
+                               'items' => array(
+                                       array('', ''),
+                                       array('RGB', 'RGB'),
+                                       array('CMYK', 'CMYK'),
+                                       array('CMY', 'CMY'),
+                                       array('YUV', 'YUV'),
+                                       array('Grey', 'grey'),
+                                       array('indexed', 'indx'),
+                               ),
+                               'default' => '',
+                               'readOnly' => TRUE,
+                       )
+               ),
+               'width' => array(
+                       'exclude' => 1,
+                       'l10n_mode' => 'exclude',
+                       'l10n_display' => 'defaultAsReadonly',
+                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.width',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => '10',
+                               'max' => '20',
+                               'eval' => 'int',
+                               'default' => '0',
+                               'readOnly' => TRUE,
+                       ),
+               ),
+               'height' => array(
+                       'exclude' => 1,
+                       'l10n_mode' => 'exclude',
+                       'l10n_display' => 'defaultAsReadonly',
+                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.height',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => '10',
+                               'max' => '20',
+                               'eval' => 'int',
+                               'default' => '0',
+                               'readOnly' => TRUE,
+                       ),
+               ),
+               'pages' => array(
+                       'exclude' => 1,
+                       'l10n_mode' => 'exclude',
+                       'l10n_display' => 'defaultAsReadonly',
+                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.pages',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => 30,
+                               'eval' => 'trim',
+                               'readOnly' => TRUE
+                       ),
+               ),
+               'language' => array(
+                       'exclude' => 1,
+                       'l10n_mode' => 'exclude',
+                       'l10n_display' => 'defaultAsReadonly',
+                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.language',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => 30,
+                               'eval' => 'trim'
+                       )
+               ),
+               'fe_groups' => array(
+                       'exclude' => 1,
+                       'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.fe_group',
+                       'config' => array(
+                               'type' => 'select',
+                               'size' => 5,
+                               'maxitems' => 20,
+                               'items' => array(
+                                       array(
+                                               'LLL:EXT:lang/locallang_general.xlf:LGL.hide_at_login',
+                                               -1
+                                       ),
+                                       array(
+                                               'LLL:EXT:lang/locallang_general.xlf:LGL.any_login',
+                                               -2
+                                       ),
+                                       array(
+                                               'LLL:EXT:lang/locallang_general.xlf:LGL.usergroups',
+                                               '--div--'
+                                       )
+                               ),
+                               'exclusiveKeys' => '-1,-2',
+                               'foreign_table' => 'fe_groups',
+                               'foreign_table_where' => 'ORDER BY fe_groups.title'
+                       )
+               ),
+       ),
+);
+
+$GLOBALS['TCA']['sys_file_metadata'] = array_replace_recursive($GLOBALS['TCA']['sys_file_metadata'], $tca);
diff --git a/typo3/sysext/filemetadata/Configuration/TCA/sys_file_metadata.php b/typo3/sysext/filemetadata/Configuration/TCA/sys_file_metadata.php
deleted file mode 100644 (file)
index 888201d..0000000
+++ /dev/null
@@ -1,443 +0,0 @@
-<?php
-if (!defined('TYPO3_MODE')) die ('Access denied.');
-
-$tca = array(
-       'ctrl' => array(
-               'type' => 'file:type',
-       ),
-       'types' => array(
-               TYPO3\CMS\Core\Resource\File::FILETYPE_UNKNOWN => array('showitem' => '
-                                                               fileinfo, title, description, alternative, keywords, caption, download_name,
-
-                                                               --div--;LLL:EXT:cms/locallang_ttc.xml:tabs.access,
-                                                                       --palette--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:palette.visibility;10;; ,
-                                                                       fe_groups,
-
-                                                               --div--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:tabs.metadata,
-                                                                       creator, --palette--;;20;;,
-                                                                       --palette--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:palette.geo_location;40;;'),
-
-               TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => array('showitem' => '
-                                                               fileinfo, title, description, alternative, keywords, caption, download_name,
-
-                                                               --div--;LLL:EXT:cms/locallang_ttc.xml:tabs.access,
-                                                                       --palette--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:palette.visibility;10;; ,
-                                                                       fe_groups,
-
-                                                               --div--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:tabs.metadata,
-                                                                       creator, --palette--;;20;;,
-                                                                       --palette--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:palette.geo_location;40;;,
-                                                                       language'),
-
-               TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => array('showitem' => '
-                                                               fileinfo, title, description, alternative, keywords, caption, download_name,
-
-                                                               --div--;LLL:EXT:cms/locallang_ttc.xml:tabs.access,
-                                                                       --palette--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:palette.visibility;10;; ,
-                                                                       fe_groups,
-
-                                                               --div--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:tabs.metadata,
-                                                                       creator, --palette--;;20;;,
-                                                                       --palette--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:palette.geo_location;40;; ,
-                                                                       --palette--;;30;;,
-                                                                       --palette--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:palette.metrics;50;;'),
-
-               TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => array('showitem' => '
-
-                                                               fileinfo, title, description, alternative, keywords, caption, download_name,
-
-                                                               --div--;LLL:EXT:cms/locallang_ttc.xml:tabs.access,
-                                                                       --palette--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:palette.visibility;10;; ,
-                                                                       fe_groups,
-
-                                                               --div--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:tabs.metadata,
-                                                                       duration,
-                                                                       creator, --palette--;;20;;, language'),
-
-               TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => array('showitem' => '
-                                                               fileinfo, title, description, alternative, keywords, caption, download_name,
-
-                                                               --div--;LLL:EXT:cms/locallang_ttc.xml:tabs.access,
-                                                                       --palette--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:palette.visibility;10;; ,
-                                                                       fe_groups,
-
-                                                               --div--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:tabs.metadata,
-                                                                       duration,
-                                                                       creator, --palette--;;20;;, language'),
-
-               TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => array('showitem' => '
-                                                               fileinfo, title, description, alternative, keywords, caption, download_name,
-
-                                                               --div--;LLL:EXT:cms/locallang_ttc.xml:tabs.access,
-                                                                       --palette--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:palette.visibility;10;; ,
-                                                                       fe_groups,
-
-                                                               --div--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:tabs.metadata,
-                                                                       creator, --palette--;;20;;,
-                                                                       --palette--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:palette.geo_location;40;; ,
-                                                                       language, --palette--;LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:palette.content_date;60;;, pages'),
-       ),
-       'palettes' => array(
-               '10' => array('showitem' => 'visible, status, ranking', 'canNotCollapse' => '1'),
-               '20' => array('showitem' => 'creator_tool, publisher, source', 'canNotCollapse' => '1'),
-               '30' => array('showitem' => 'latitude, longitude', 'canNotCollapse' => '1'),
-               '40' => array('showitem' => 'location_country, location_region, location_city', 'canNotCollapse' => '1'),
-               '50' => array('showitem' => 'width, height, unit, color_space', 'canNotCollapse' => '1'),
-               '60' => array('showitem' => 'content_creation_date, content_modification_date', 'canNotCollapse' => '1'),
-       ),
-       'columns' => array(
-               'visible' => array(
-                       'exclude' => 1,
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.visible',
-                       'config' => array(
-                               'type' => 'check',
-                               'default' => '1'
-                       ),
-               ),
-               'status' => array(
-                       'exclude' => 1,
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.status',
-                       'config' => array(
-                               'type' => 'select',
-                               'items' => array(
-                                       array(
-                                               'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.status.1',
-                                               1,
-                                               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('filemetadata') . 'Resources/Public/Icons/status_1.png'
-                                       ),
-                                       array(
-                                               'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.status.2',
-                                               2,
-                                               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('filemetadata') . 'Resources/Public/Icons/status_2.png'
-                                       ),
-                                       array(
-                                               'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.status.3',
-                                               3,
-                                               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('filemetadata') . 'Resources/Public/Icons/status_3.png'
-                                       ),
-                               ),
-                       ),
-               ),
-               'keywords' => array(
-                       'exclude' => 1,
-                       'l10n_mode' => 'prefixLangTitle',
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.keywords',
-                       'config' => array(
-                               'placeholder' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:placeholder.keywords',
-                               'type' => 'input',
-                               'size' => 255,
-                               'eval' => 'trim'
-                       ),
-               ),
-               'caption' => array(
-                       'exclude' => 1,
-                       'l10n_mode' => 'prefixLangTitle',
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.caption',
-                       'config' => array(
-                               'type' => 'input',
-                               'size' => 30,
-                               'eval' => 'trim'
-                       ),
-               ),
-               'creator_tool' => array(
-                       'exclude' => 1,
-                       'l10n_mode' => 'exclude',
-                       'l10n_display' => 'defaultAsReadonly',
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.creator_tool',
-                       'config' => array(
-                               'type' => 'input',
-                               'size' => 20,
-                               'eval' => 'trim'
-                       ),
-               ),
-               'download_name' => array(
-                       'exclude' => 1,
-                       'l10n_mode' => 'exclude',
-                       'l10n_display' => 'defaultAsReadonly',
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.download_name',
-                       'config' => array(
-                               'type' => 'input',
-                               'size' => 30,
-                               'eval' => 'trim'
-                       ),
-               ),
-               'creator' => array(
-                       'exclude' => 1,
-                       'l10n_mode' => 'exclude',
-                       'l10n_display' => 'defaultAsReadonly',
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.creator',
-                       'config' => array(
-                               'type' => 'input',
-                               'size' => 30,
-                               'eval' => 'trim'
-                       ),
-               ),
-               'publisher' => array(
-                       'exclude' => 1,
-                       'l10n_mode' => 'exclude',
-                       'l10n_display' => 'defaultAsReadonly',
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.publisher',
-                       'config' => array(
-                               'type' => 'input',
-                               'size' => 20,
-                               'eval' => 'trim'
-                       ),
-               ),
-               'source' => array(
-                       'exclude' => 1,
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.source',
-                       'config' => array(
-                               'type' => 'input',
-                               'size' => 20,
-                               'eval' => 'trim'
-                       ),
-               ),
-               'location_country' => array(
-                       'exclude' => 1,
-                       'l10n_mode' => 'mergeIfNotBlank',
-                       'l10n_display' => '',
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.location_country',
-                       'config' => array(
-                               'type' => 'input',
-                               'size' => 20,
-                               'eval' => 'trim'
-                       ),
-               ),
-               'location_region' => array(
-                       'exclude' => 1,
-                       'l10n_mode' => 'mergeIfNotBlank',
-                       'l10n_display' => '',
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.location_region',
-                       'config' => array(
-                               'type' => 'input',
-                               'size' => 20,
-                               'eval' => 'trim'
-                       ),
-               ),
-               'location_city' => array(
-                       'exclude' => 1,
-                       'l10n_mode' => 'mergeIfNotBlank',
-                       'l10n_display' => '',
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.location_city',
-                       'config' => array(
-                               'type' => 'input',
-                               'size' => 20,
-                               'eval' => 'trim'
-                       ),
-               ),
-               'latitude' => array(
-                       'exclude' => 1,
-                       'l10n_mode' => 'exclude',
-                       'l10n_display' => 'defaultAsReadonly',
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.latitude',
-                       'config' => array(
-                               'type' => 'input',
-                               'size' => '20',
-                               'eval' => 'trim',
-                               'max' => '30',
-                               'default' => '0.00000000000000'
-                       ),
-               ),
-               'longitude' => array(
-                       'exclude' => 1,
-                       'l10n_mode' => 'exclude',
-                       'l10n_display' => 'defaultAsReadonly',
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.longitude',
-                       'config' => array(
-                               'type' => 'input',
-                               'size' => '20',
-                               'eval' => 'trim',
-                               'max' => '30',
-                               'default' => '0.00000000000000'
-                       ),
-               ),
-               'ranking' => array(
-                       'exclude' => 1,
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.ranking',
-                       'config' => array(
-                               'type' => 'select',
-                               'minitems' => 1,
-                               'maxitems' => 1,
-                               'items' => array(
-                                       array(1, 1),
-                                       array(2, 2),
-                                       array(3, 3),
-                                       array(4, 4),
-                                       array(5, 5),
-                               ),
-                       ),
-               ),
-               'content_creation_date' => array(
-                       'exclude' => 1,
-                       'l10n_mode' => 'exclude',
-                       'l10n_display' => 'defaultAsReadonly',
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.content_creation_date',
-                       'config' => array(
-                               'type' => 'input',
-                               'size' => 12,
-                               'max' => 20,
-                               'eval' => 'date',
-                               'checkbox' => 1,
-                               'default' => time()
-                       ),
-               ),
-               'content_modification_date' => array(
-                       'exclude' => 1,
-                       'l10n_mode' => 'exclude',
-                       'l10n_display' => 'defaultAsReadonly',
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.content_modification_date',
-                       'config' => array(
-                               'type' => 'input',
-                               'size' => 12,
-                               'max' => 20,
-                               'eval' => 'date',
-                               'checkbox' => 1,
-                               'default' => time()
-                       ),
-               ),
-               'note' => array(
-                       'exclude' => 1,
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.note',
-                       'config' => array(
-                               'type' => 'text',
-                               'cols' => 40,
-                               'rows' => 15,
-                               'eval' => 'trim'
-                       ),
-               ),
-               /*
-                * METRICS ###########################################
-                */
-               'unit' => array(
-                       'exclude' => 1,
-                       'l10n_mode' => 'exclude',
-                       'l10n_display' => 'defaultAsReadonly',
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.unit',
-                       'config' => array(
-                               'type' => 'select',
-                               'items' => array(
-                                       array('', ''),
-                                       array('px', 'px'),
-                                       array('mm', 'mm'),
-                                       array('cm', 'cm'),
-                                       array('m', 'm'),
-                                       array('p', 'p'),
-                               ),
-                               'default' => '',
-                               'readOnly' => TRUE,
-                       ),
-               ),
-               'duration' => array(
-                       'exclude' => 1,
-                       'l10n_mode' => 'exclude',
-                       'l10n_display' => 'defaultAsReadonly',
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.duration',
-                       'config' => array(
-                               'type' => 'input',
-                               'size' => '10',
-                               'max' => '20',
-                               'eval' => 'int',
-                               'default' => '0'
-                       )
-               ),
-               'color_space' => array(
-                       'exclude' => 1,
-                       'l10n_mode' => 'exclude',
-                       'l10n_display' => 'defaultAsReadonly',
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.color_space',
-                       'config' => array(
-                               'type' => 'select',
-                               'items' => array(
-                                       array('', ''),
-                                       array('RGB', 'RGB'),
-                                       array('CMYK', 'CMYK'),
-                                       array('CMY', 'CMY'),
-                                       array('YUV', 'YUV'),
-                                       array('Grey', 'grey'),
-                                       array('indexed', 'indx'),
-                               ),
-                               'default' => '',
-                               'readOnly' => TRUE,
-                       )
-               ),
-               'width' => array(
-                       'exclude' => 1,
-                       'l10n_mode' => 'exclude',
-                       'l10n_display' => 'defaultAsReadonly',
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.width',
-                       'config' => array(
-                               'type' => 'input',
-                               'size' => '10',
-                               'max' => '20',
-                               'eval' => 'int',
-                               'default' => '0',
-                               'readOnly' => TRUE,
-                       ),
-               ),
-               'height' => array(
-                       'exclude' => 1,
-                       'l10n_mode' => 'exclude',
-                       'l10n_display' => 'defaultAsReadonly',
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.height',
-                       'config' => array(
-                               'type' => 'input',
-                               'size' => '10',
-                               'max' => '20',
-                               'eval' => 'int',
-                               'default' => '0',
-                               'readOnly' => TRUE,
-                       ),
-               ),
-               'pages' => array(
-                       'exclude' => 1,
-                       'l10n_mode' => 'exclude',
-                       'l10n_display' => 'defaultAsReadonly',
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.pages',
-                       'config' => array(
-                               'type' => 'input',
-                               'size' => 30,
-                               'eval' => 'trim',
-                               'readOnly' => TRUE
-                       ),
-               ),
-               'language' => array(
-                       'exclude' => 1,
-                       'l10n_mode' => 'exclude',
-                       'l10n_display' => 'defaultAsReadonly',
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.language',
-                       'config' => array(
-                               'type' => 'input',
-                               'size' => 30,
-                               'eval' => 'trim'
-                       )
-               ),
-               'fe_groups' => array(
-                       'exclude' => 1,
-                       'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.fe_group',
-                       'config' => array(
-                               'type' => 'select',
-                               'size' => 5,
-                               'maxitems' => 20,
-                               'items' => array(
-                                       array(
-                                               'LLL:EXT:lang/locallang_general.xlf:LGL.hide_at_login',
-                                               -1
-                                       ),
-                                       array(
-                                               'LLL:EXT:lang/locallang_general.xlf:LGL.any_login',
-                                               -2
-                                       ),
-                                       array(
-                                               'LLL:EXT:lang/locallang_general.xlf:LGL.usergroups',
-                                               '--div--'
-                                       )
-                               ),
-                               'exclusiveKeys' => '-1,-2',
-                               'foreign_table' => 'fe_groups',
-                               'foreign_table_where' => 'ORDER BY fe_groups.title'
-                       )
-               ),
-       ),
-);
-
-return array_replace_recursive($GLOBALS['TCA']['sys_file_metadata'], $tca);