Skip to content

Commit

Permalink
[TASK] v13/v14 compatibility: Use \TYPO3\CMS\Core\Resource\FileType ENUM
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminkott committed Nov 11, 2024
1 parent c57aa69 commit 73e08ea
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 39 deletions.
12 changes: 4 additions & 8 deletions Classes/ViewHelpers/File/IsAudioViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use TYPO3\CMS\Core\Resource\File;
use TYPO3\CMS\Core\Resource\FileReference;
use TYPO3\CMS\Core\Resource\FileType;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;

Expand All @@ -25,16 +26,11 @@ public function render()
$allowedFileExtensions = $GLOBALS['TYPO3_CONF_VARS']['SYS']['audiofile_ext'] ?? '';
$allowedFileExtensions = GeneralUtility::trimExplode(',', $allowedFileExtensions);

if (is_object($file)
return is_object($file)
&& ($file instanceof FileReference || $file instanceof File)
&& (
in_array($file->getExtension(), $allowedFileExtensions, true)
|| $file->getType() === File::FILETYPE_AUDIO
)
) {
return true;
}

return false;
|| $file->getType() === FileType::AUDIO->value

Check failure on line 33 in Classes/ViewHelpers/File/IsAudioViewHelper.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.2)

Access to constant AUDIO on an unknown class TYPO3\CMS\Core\Resource\FileType.

Check failure on line 33 in Classes/ViewHelpers/File/IsAudioViewHelper.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.3)

Access to constant AUDIO on an unknown class TYPO3\CMS\Core\Resource\FileType.

Check failure on line 33 in Classes/ViewHelpers/File/IsAudioViewHelper.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.1)

Access to constant AUDIO on an unknown class TYPO3\CMS\Core\Resource\FileType.
);
}
}
12 changes: 4 additions & 8 deletions Classes/ViewHelpers/File/IsImageViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use TYPO3\CMS\Core\Resource\File;
use TYPO3\CMS\Core\Resource\FileReference;
use TYPO3\CMS\Core\Resource\FileType;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;

Expand All @@ -25,16 +26,11 @@ public function render()
$allowedFileExtensions = $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] ?? '';
$allowedFileExtensions = GeneralUtility::trimExplode(',', $allowedFileExtensions);

if (is_object($file)
return is_object($file)
&& ($file instanceof FileReference || $file instanceof File)
&& (
in_array($file->getExtension(), $allowedFileExtensions, true)
|| $file->getType() === File::FILETYPE_IMAGE
)
) {
return true;
}

return false;
|| $file->getType() === FileType::IMAGE->value

Check failure on line 33 in Classes/ViewHelpers/File/IsImageViewHelper.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.2)

Access to constant IMAGE on an unknown class TYPO3\CMS\Core\Resource\FileType.

Check failure on line 33 in Classes/ViewHelpers/File/IsImageViewHelper.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.3)

Access to constant IMAGE on an unknown class TYPO3\CMS\Core\Resource\FileType.

Check failure on line 33 in Classes/ViewHelpers/File/IsImageViewHelper.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.1)

Access to constant IMAGE on an unknown class TYPO3\CMS\Core\Resource\FileType.
);
}
}
12 changes: 4 additions & 8 deletions Classes/ViewHelpers/File/IsMediaViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use TYPO3\CMS\Core\Resource\File;
use TYPO3\CMS\Core\Resource\FileReference;
use TYPO3\CMS\Core\Resource\FileType;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;

Expand All @@ -25,16 +26,11 @@ public function render()
$allowedFileExtensions = $GLOBALS['TYPO3_CONF_VARS']['SYS']['mediafile_ext'] ?? '';
$allowedFileExtensions = GeneralUtility::trimExplode(',', $allowedFileExtensions);

if (is_object($file)
return is_object($file)
&& ($file instanceof FileReference || $file instanceof File)
&& (
in_array($file->getExtension(), $allowedFileExtensions, true)
|| $file->getType() === File::FILETYPE_VIDEO
)
) {
return true;
}

return false;
|| $file->getType() === FileType::VIDEO->value

Check failure on line 33 in Classes/ViewHelpers/File/IsMediaViewHelper.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.2)

Access to constant VIDEO on an unknown class TYPO3\CMS\Core\Resource\FileType.

Check failure on line 33 in Classes/ViewHelpers/File/IsMediaViewHelper.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.3)

Access to constant VIDEO on an unknown class TYPO3\CMS\Core\Resource\FileType.

Check failure on line 33 in Classes/ViewHelpers/File/IsMediaViewHelper.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.1)

Access to constant VIDEO on an unknown class TYPO3\CMS\Core\Resource\FileType.
);
}
}
4 changes: 2 additions & 2 deletions Configuration/TCA/Overrides/100_pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
],
'overrideChildTca' => [
'types' => [
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
\TYPO3\CMS\Core\Resource\FileType::IMAGE->value => [

Check failure on line 91 in Configuration/TCA/Overrides/100_pages.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.2)

Access to constant IMAGE on an unknown class TYPO3\CMS\Core\Resource\FileType.

Check failure on line 91 in Configuration/TCA/Overrides/100_pages.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.3)

Access to constant IMAGE on an unknown class TYPO3\CMS\Core\Resource\FileType.

Check failure on line 91 in Configuration/TCA/Overrides/100_pages.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.1)

Access to constant IMAGE on an unknown class TYPO3\CMS\Core\Resource\FileType.
'showitem' => '--palette--;;filePalette',
],
],
Expand All @@ -108,7 +108,7 @@
'maxitems' => 1,
'overrideChildTca' => [
'types' => [
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
\TYPO3\CMS\Core\Resource\FileType::IMAGE->value => [

Check failure on line 111 in Configuration/TCA/Overrides/100_pages.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.2)

Access to constant IMAGE on an unknown class TYPO3\CMS\Core\Resource\FileType.

Check failure on line 111 in Configuration/TCA/Overrides/100_pages.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.3)

Access to constant IMAGE on an unknown class TYPO3\CMS\Core\Resource\FileType.

Check failure on line 111 in Configuration/TCA/Overrides/100_pages.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.1)

Access to constant IMAGE on an unknown class TYPO3\CMS\Core\Resource\FileType.
'showitem' => '
--palette--;;imageoverlayPalette,
--palette--;;filePalette
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
],
'overrideChildTca' => [
'types' => [
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
\TYPO3\CMS\Core\Resource\FileType::IMAGE->value => [

Check failure on line 129 in Configuration/TCA/Overrides/225_content_element_texticon.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.2)

Access to constant IMAGE on an unknown class TYPO3\CMS\Core\Resource\FileType.

Check failure on line 129 in Configuration/TCA/Overrides/225_content_element_texticon.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.3)

Access to constant IMAGE on an unknown class TYPO3\CMS\Core\Resource\FileType.

Check failure on line 129 in Configuration/TCA/Overrides/225_content_element_texticon.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.1)

Access to constant IMAGE on an unknown class TYPO3\CMS\Core\Resource\FileType.
'showitem' => '--palette--;;filePalette',
],
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
],
'overrideChildTca' => [
'types' => [
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
\TYPO3\CMS\Core\Resource\FileType::IMAGE->value => [

Check failure on line 185 in Configuration/TCA/Overrides/300_content_general_columns.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.2)

Access to constant IMAGE on an unknown class TYPO3\CMS\Core\Resource\FileType.

Check failure on line 185 in Configuration/TCA/Overrides/300_content_general_columns.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.3)

Access to constant IMAGE on an unknown class TYPO3\CMS\Core\Resource\FileType.

Check failure on line 185 in Configuration/TCA/Overrides/300_content_general_columns.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.1)

Access to constant IMAGE on an unknown class TYPO3\CMS\Core\Resource\FileType.
'showitem' => 'crop,--palette--;;filePalette',
],
],
Expand Down
4 changes: 2 additions & 2 deletions Configuration/TCA/tx_bootstrappackage_accordion_item.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,12 @@
],
'overrideChildTca' => [
'types' => [
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
\TYPO3\CMS\Core\Resource\FileType::IMAGE->value => [

Check failure on line 192 in Configuration/TCA/tx_bootstrappackage_accordion_item.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.2)

Access to constant IMAGE on an unknown class TYPO3\CMS\Core\Resource\FileType.

Check failure on line 192 in Configuration/TCA/tx_bootstrappackage_accordion_item.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.3)

Access to constant IMAGE on an unknown class TYPO3\CMS\Core\Resource\FileType.

Check failure on line 192 in Configuration/TCA/tx_bootstrappackage_accordion_item.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.1)

Access to constant IMAGE on an unknown class TYPO3\CMS\Core\Resource\FileType.
'showitem' => '
--palette--;;imageoverlayPalette,
--palette--;;filePalette',
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [
\TYPO3\CMS\Core\Resource\FileType::VIDEO->value => [

Check failure on line 197 in Configuration/TCA/tx_bootstrappackage_accordion_item.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.2)

Access to constant VIDEO on an unknown class TYPO3\CMS\Core\Resource\FileType.

Check failure on line 197 in Configuration/TCA/tx_bootstrappackage_accordion_item.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.3)

Access to constant VIDEO on an unknown class TYPO3\CMS\Core\Resource\FileType.

Check failure on line 197 in Configuration/TCA/tx_bootstrappackage_accordion_item.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.1)

Access to constant VIDEO on an unknown class TYPO3\CMS\Core\Resource\FileType.
'showitem' => '
--palette--;;videoOverlayPalette,
--palette--;;filePalette',
Expand Down
4 changes: 2 additions & 2 deletions Configuration/TCA/tx_bootstrappackage_card_group_item.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
'maxitems' => 1,
'overrideChildTca' => [
'types' => [
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
\TYPO3\CMS\Core\Resource\FileType::IMAGE->value => [

Check failure on line 200 in Configuration/TCA/tx_bootstrappackage_card_group_item.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.2)

Access to constant IMAGE on an unknown class TYPO3\CMS\Core\Resource\FileType.

Check failure on line 200 in Configuration/TCA/tx_bootstrappackage_card_group_item.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.3)

Access to constant IMAGE on an unknown class TYPO3\CMS\Core\Resource\FileType.

Check failure on line 200 in Configuration/TCA/tx_bootstrappackage_card_group_item.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.1)

Access to constant IMAGE on an unknown class TYPO3\CMS\Core\Resource\FileType.
'showitem' => '
--palette--;;imageoverlayPalette,
--palette--;;filePalette',
Expand Down Expand Up @@ -275,7 +275,7 @@
],
'overrideChildTca' => [
'types' => [
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
\TYPO3\CMS\Core\Resource\FileType::IMAGE->value => [
'showitem' => '--palette--;;filePalette',
],
],
Expand Down
4 changes: 2 additions & 2 deletions Configuration/TCA/tx_bootstrappackage_carousel_item.php
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@
'maxitems' => 1,
'overrideChildTca' => [
'types' => [
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
\TYPO3\CMS\Core\Resource\FileType::IMAGE->value => [
'showitem' => '
--palette--;;imageoverlayPalette,
--palette--;;filePalette',
Expand Down Expand Up @@ -641,7 +641,7 @@
],
'overrideChildTca' => [
'types' => [
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
\TYPO3\CMS\Core\Resource\FileType::IMAGE->value => [
'showitem' => 'crop,--palette--;;filePalette',
],
],
Expand Down
2 changes: 1 addition & 1 deletion Configuration/TCA/tx_bootstrappackage_icon_group_item.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
],
'overrideChildTca' => [
'types' => [
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
\TYPO3\CMS\Core\Resource\FileType::IMAGE->value => [
'showitem' => '--palette--;;filePalette',
],
],
Expand Down
4 changes: 2 additions & 2 deletions Configuration/TCA/tx_bootstrappackage_tab_item.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,12 @@
],
'overrideChildTca' => [
'types' => [
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
\TYPO3\CMS\Core\Resource\FileType::IMAGE->value => [
'showitem' => '
--palette--;;imageoverlayPalette,
--palette--;;filePalette',
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [
\TYPO3\CMS\Core\Resource\FileType::VIDEO->value => [
'showitem' => '
--palette--;;videoOverlayPalette,
--palette--;;filePalette',
Expand Down
4 changes: 2 additions & 2 deletions Configuration/TCA/tx_bootstrappackage_timeline_item.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
],
'overrideChildTca' => [
'types' => [
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
\TYPO3\CMS\Core\Resource\FileType::IMAGE->value => [
'showitem' => '--palette--;;filePalette',
],
],
Expand All @@ -243,7 +243,7 @@
'maxitems' => 1,
'overrideChildTca' => [
'types' => [
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
\TYPO3\CMS\Core\Resource\FileType::IMAGE->value => [
'showitem' => '
--palette--;;imageoverlayPalette,
--palette--;;filePalette',
Expand Down

0 comments on commit 73e08ea

Please sign in to comment.