Skip to content

Commit

Permalink
[TASK] add v13 compatibility and drop v11
Browse files Browse the repository at this point in the history
  • Loading branch information
t3brightside committed Feb 8, 2024
1 parent 3b6bac8 commit a19bea9
Show file tree
Hide file tree
Showing 7 changed files with 156 additions and 192 deletions.
266 changes: 120 additions & 146 deletions Configuration/TCA/Overrides/sys_file_reference.php
Original file line number Diff line number Diff line change
@@ -1,52 +1,46 @@
<?php

$youtubeVideoColumns = array(
'tx_youtubevideo_rel' => array (
'exclude' => 1,
'label' => 'LLL:EXT:youtubevideo/Resources/Private/Language/locallang_db.xlf:tx_youtubevideo_rel.title',
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
'default' => 1,
'behaviour' => [
'allowLanguageSynchronization' => true,
],
'items' => [
[
0 => '',
1 => '',
]
],
]
),
'tx_youtubevideo_starttime' => array(
'exclude' => 0,
'label' => 'LLL:EXT:youtubevideo/Resources/Private/Language/locallang_db.xlf:tx_youtubevideo_starttime.title',
'config' => array(
'type' => 'input',
'size' => '8',
'eval' => 'trim,nospace,Brightside\Youtubevideo\Evaluation\HoursMinutesSeconds',
'behaviour' => [
'allowLanguageSynchronization' => true,
],
),
),
'tx_youtubevideo_endtime' => array(
'exclude' => 0,
'label' => 'LLL:EXT:youtubevideo/Resources/Private/Language/locallang_db.xlf:tx_youtubevideo_endtime.title',
'config' => array(
'type' => 'input',
'size' => '1',
'eval' => 'trim,nospace,Brightside\Youtubevideo\Evaluation\HoursMinutesSeconds',
'behaviour' => [
'allowLanguageSynchronization' => true,
],
),
),
'tx_youtubevideo_ratio' => array(
'tx_youtubevideo_rel' => [
'exclude' => 1,
'label' => 'LLL:EXT:youtubevideo/Resources/Private/Language/locallang_db.xlf:tx_youtubevideo_rel.title',
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
'default' => 1,
'behaviour' => [
'allowLanguageSynchronization' => true,
],
],
],
'tx_youtubevideo_starttime' => [
'exclude' => 0,
'label' => 'LLL:EXT:youtubevideo/Resources/Private/Language/locallang_db.xlf:tx_youtubevideo_starttime.title',
'config' => [
'type' => 'input',
'size' => '8',
'eval' => 'trim,nospace,Brightside\Youtubevideo\Evaluation\HoursMinutesSeconds',
'behaviour' => [
'allowLanguageSynchronization' => true,
],
],
],
'tx_youtubevideo_endtime' => [
'exclude' => 0,
'label' => 'LLL:EXT:youtubevideo/Resources/Private/Language/locallang_db.xlf:tx_youtubevideo_endtime.title',
'config' => [
'type' => 'input',
'size' => '1',
'eval' => 'trim,nospace,Brightside\Youtubevideo\Evaluation\HoursMinutesSeconds',
'behaviour' => [
'allowLanguageSynchronization' => true,
],
],
],
'tx_youtubevideo_ratio' => [
'exclude' => 1,
'label' => 'LLL:EXT:youtubevideo/Resources/Private/Language/locallang_db.xlf:tx_youtubevideo_ratio.title',
'config' => array(
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'items' => [
Expand All @@ -56,118 +50,98 @@
'size' => 1,
'maxitems' => 1,
'behaviour' => [
'allowLanguageSynchronization' => true,
'allowLanguageSynchronization' => true,
]
)
),
'tx_youtubevideo_mute' => array (
'exclude' => 1,
'label' => 'LLL:EXT:youtubevideo/Resources/Private/Language/locallang_db.xlf:tx_youtubevideo_mute.title',
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
'behaviour' => [
'allowLanguageSynchronization' => true,
],
'items' => [
[
0 => '',
1 => '',
]
],
'tx_youtubevideo_mute' => [
'exclude' => 1,
'label' => 'LLL:EXT:youtubevideo/Resources/Private/Language/locallang_db.xlf:tx_youtubevideo_mute.title',
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
'behaviour' => [
'allowLanguageSynchronization' => true,
],

],
],
'tx_youtubevideo_fullscreen' => [
'exclude' => 1,
'label' => 'LLL:EXT:youtubevideo/Resources/Private/Language/locallang_db.xlf:tx_youtubevideo_fullscreen.title',
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
'default' => 1,
'behaviour' => [
'allowLanguageSynchronization' => true,
],
],
]
),
'tx_youtubevideo_fullscreen' => array (
'exclude' => 1,
'label' => 'LLL:EXT:youtubevideo/Resources/Private/Language/locallang_db.xlf:tx_youtubevideo_fullscreen.title',
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
'default' => 1,
'behaviour' => [
'allowLanguageSynchronization' => true,
],
'items' => [
[
0 => '',
1 => '',
'invertStateDisplay' => false,
]
],
]
),
'tx_youtubevideo_loop' => array (
'exclude' => 1,
'label' => 'LLL:EXT:youtubevideo/Resources/Private/Language/locallang_db.xlf:tx_youtubevideo_loop.title',
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
'behaviour' => [
'allowLanguageSynchronization' => true,
],
'items' => [
[
0 => '',
1 => '',
]
],
]
),
'tx_youtubevideo_coverimage' => [
'exclude' => 1,
'label' => 'LLL:EXT:youtubevideo/Resources/Private/Language/locallang_db.xlf:tx_youtubevideo_cover.image',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'tx_youtubevideo_coverimage',
[
'behaviour' => [
'allowLanguageSynchronization' => true,
],
'tx_youtubevideo_loop' => [
'exclude' => 1,
'label' => 'LLL:EXT:youtubevideo/Resources/Private/Language/locallang_db.xlf:tx_youtubevideo_loop.title',
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
'behaviour' => [
'allowLanguageSynchronization' => true,
],
],
'overrideChildTca' => [
'columns' => [
'crop' => [
'config' => [
'cropVariants' => [
'widescreen' => [
'title' => 'Widescreen (16:9)',
'selectedRatio' => '16:9',
'allowedAspectRatios' => [
'16:9' => [
'title' => 'Widescreen',
'value' => 16 / 9,
],
],
'tx_youtubevideo_coverimage' => [
'exclude' => 1,
'label' => 'LLL:EXT:youtubevideo/Resources/Private/Language/locallang_db.xlf:tx_youtubevideo_cover.image',
'config' => [
'type' => 'file',
'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
'behaviour' => [
'allowLanguageSynchronization' => true,
],
'overrideChildTca' => [
'columns' => [
'crop' => [
'config' => [
'cropVariants' => [
'widescreen' => [
'title' => 'Widescreen (16:9)',
'selectedRatio' => '16:9',
'allowedAspectRatios' => [
'16:9' => [
'title' => 'Widescreen',
'value' => 16 / 9,
],
],
],
'tv' => [
'title' => 'Standard (4:3)',
'selectedRatio' => '4:3',
'allowedAspectRatios' => [
'4:3' => [
'title' => 'TV',
'value' => 4 / 3,
],
],
],
],
],
],
],
'types' => [
'0' => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
],
'tv' => [
'title' => 'Standard (4:3)',
'selectedRatio' => '4:3',
'allowedAspectRatios' => [
'4:3' => [
'title' => 'TV',
'value' => 4 / 3,
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
'showitem' => '
crop,
--palette--;;filePalette'
],
],
],
],
],
],
'types' => [
'0' => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
'showitem' => '
crop,
--palette--;;filePalette'
],
],
],
],
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
),
],
);

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(
Expand Down
46 changes: 23 additions & 23 deletions Configuration/TCA/Overrides/tt_content.php
Original file line number Diff line number Diff line change
@@ -1,45 +1,50 @@
<?php
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;

defined('TYPO3_MODE') || defined('TYPO3') || die('Access denied.');

$GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes']['youtubevideo_pi1'] = 'youtubevideo_icon';

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr(
'tt_content', 'EXT:youtubevideo/Resources/Private/Language/locallang_db.xlf'
);

// Get extension configuration
$extensionConfiguration = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class
$extensionConfiguration = GeneralUtility::makeInstance(
ExtensionConfiguration::class
);
$extensionConfiguration = $extensionConfiguration->get('youtubevideo');

// Add to content type dropdown
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem(
"tt_content",
"CType",
ExtensionManagementUtility::addTcaSelectItem(
'tt_content',
'CType',
[
'YouTube Video',
'youtubevideo_pi1',
'youtubevideo_icon'
'label' => 'YouTube Video',
'description' => '',
'value' => 'youtubevideo_pi1',
'icon' => 'youtubevideo_icon',
'group' => 'default',
],
'textmedia',
'after'
);



$tempColumns = array(
'tx_youtubevideo_assets' => [
'exclude' => 1,
'label' => 'Video',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('tx_youtubevideo_assets', [
'behaviour' => [
'config' => [
'type' => 'file',
'allowed' => 'youtube',
'behaviour' => [
'allowLanguageSynchronization' => true,
],
'appearance' => [
'createNewRelationLinkTitle' => 'Video',
'showPossibleLocalizationRecords' => true,
],
'overrideChildTca' => [
'overrideChildTca' => [
'types' => [
\TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [
'showitem' => '
Expand All @@ -48,7 +53,8 @@
],
],
],
], 'youtube'),
],

],
'tx_youtubevideo_colcount' => [
'exclude' => 1,
Expand Down Expand Up @@ -86,20 +92,14 @@
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
'items' => [
[
0 => '',
1 => '',
]
],
'behaviour' => [
'allowLanguageSynchronization' => true,
],
]
],
);

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', $tempColumns);
ExtensionManagementUtility::addTCAcolumns('tt_content', $tempColumns);
$GLOBALS['TCA']['tt_content']['types']['youtubevideo_pi1']['previewRenderer'] = \Brightside\Youtubevideo\Preview\YoutubevideoPreviewRenderer::class;
$GLOBALS['TCA']['tt_content']['types']['youtubevideo_pi1']['showitem'] = '
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
Expand Down
Loading

0 comments on commit a19bea9

Please sign in to comment.