Skip to content

Commit

Permalink
[TASK] Unify TCA and ext_localconf.php structures
Browse files Browse the repository at this point in the history
  • Loading branch information
theLine committed Aug 4, 2020
1 parent 878ae00 commit 5890157
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 42 deletions.
72 changes: 38 additions & 34 deletions Configuration/TCA/Overrides/sys_file_metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,43 @@
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;

$columns = [
'tx_lottie_is_lottie_animation' => [
'exclude' => true,
'label' => 'LLL:EXT:lottie/Resources/Private/Language/locallang_db.xlf:sys_file_metadata.tx_lottie_is_lottie_animation',
'config' => [
'type' => 'check',
'items' => [
['', 1],
call_user_func(function() {

$columns = [
'tx_lottie_is_lottie_animation' => [
'exclude' => true,
'label' => 'LLL:EXT:lottie/Resources/Private/Language/locallang_db.xlf:sys_file_metadata.tx_lottie_is_lottie_animation',
'config' => [
'type' => 'check',
'items' => [
['', 1],
],
],
'displayCond' => 'USER:'. \TheLine\Lottie\Backend\DisplayConditions::class .'->checkIfIsJsonFile',
],
'displayCond' => 'USER:'. \TheLine\Lottie\Backend\DisplayConditions::class .'->checkIfIsJsonFile',
],
];

if (
VersionNumberUtility::convertVersionNumberToInteger(
VersionNumberUtility::getNumericTypo3Version()
) >= 9000000
) {
$columns['tx_lottie_is_lottie_animation']['config']['renderType'] = 'checkboxToggle';
}


ExtensionManagementUtility::addTCAcolumns(
'sys_file_metadata',
$columns
);

ExtensionManagementUtility::addToAllTCAtypes(
'sys_file_metadata',
implode(',', array_keys($columns)),
implode(',', [
File::FILETYPE_TEXT,
File::FILETYPE_APPLICATION
])
);
];

if (
VersionNumberUtility::convertVersionNumberToInteger(
VersionNumberUtility::getNumericTypo3Version()
) >= 9000000
) {
$columns['tx_lottie_is_lottie_animation']['config']['renderType'] = 'checkboxToggle';
}


ExtensionManagementUtility::addTCAcolumns(
'sys_file_metadata',
$columns
);

ExtensionManagementUtility::addToAllTCAtypes(
'sys_file_metadata',
implode(',', array_keys($columns)),
implode(',', [
File::FILETYPE_TEXT,
File::FILETYPE_APPLICATION
])
);

});
16 changes: 11 additions & 5 deletions Configuration/TCA/Overrides/sys_template.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
<?php

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
'lottie',
'Configuration/TypoScript',
'EXT:lottie :: JavaScript includes for lottie-web'
);
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

call_user_func(function() {

ExtensionManagementUtility::addStaticFile(
'lottie',
'Configuration/TypoScript',
'EXT:lottie :: JavaScript includes for lottie-web'
);

});
5 changes: 2 additions & 3 deletions ext_localconf.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
defined('TYPO3_MODE') or die();

call_user_func(function($extKey) {
call_user_func(function() {

/** @var \TYPO3\CMS\Core\Resource\Rendering\RendererRegistry $rendererRegistry */
$rendererRegistry = \TYPO3\CMS\Core\Resource\Rendering\RendererRegistry::getInstance();
Expand All @@ -14,5 +14,4 @@
// which is only present in `textmedia` CType by default
$GLOBALS['TYPO3_CONF_VARS']['SYS']['mediafile_ext'] .= ',json';

}, $_EXTKEY);

});

0 comments on commit 5890157

Please sign in to comment.