From 2d83f2722f85abe35c6ff88d9ee42f16480d3f68 Mon Sep 17 00:00:00 2001 From: Daniel Gohlke Date: Wed, 3 Apr 2024 10:20:44 +0200 Subject: [PATCH 1/6] [TASK] Add possibility to override for sizes Related: #16 --- Classes/Sizes/BackendLayout/Column.php | 23 ++++++- Classes/Sizes/Container.php | 22 +++++-- Classes/Sizes/ContentElement.php | 53 ++++++++++++++++ Classes/Sizes/ContentElementInterface.php | 4 ++ Classes/Sizes/Rootline.php | 44 +++++++------ .../ContentElements/imageFixWidth.typoscript | 36 +++++++++++ .../TypoScript/Rendering.typoscript | 2 +- .../Fixtures/0colImageFixWidthDatabase.php | 32 ++++++++++ .../tt_content_container_1col_full_width.php | 23 +++++++ .../Container/1col-full-witdh.typoscript | 22 +++++++ .../Fixtures/0colImageFixWidthDatabase.php | 33 ++++++++++ .../Fixtures/1col2colFullWidthDatabase.php | 61 +++++++++++++++++++ .../Test/Fixtures/1colFullWidthDatabase.php | 47 ++++++++++++++ .../Fixtures/3colImageFixWidthDatabase.php | 47 ++++++++++++++ Tests/Functional/BaseTest.php | 10 +++ Tests/Functional/ContainerTest.php | 40 ++++++++++++ 16 files changed, 473 insertions(+), 26 deletions(-) create mode 100644 Tests/Fixtures/base_example/Configuration/TypoScript/ContentElements/imageFixWidth.typoscript create mode 100644 Tests/Fixtures/base_example/Test/Fixtures/0colImageFixWidthDatabase.php create mode 100644 Tests/Fixtures/container_example/Configuration/TCA/Overrides/tt_content_container_1col_full_width.php create mode 100644 Tests/Fixtures/container_example/Configuration/TypoScript/Container/1col-full-witdh.typoscript create mode 100644 Tests/Fixtures/container_example/Test/Fixtures/0colImageFixWidthDatabase.php create mode 100644 Tests/Fixtures/container_example/Test/Fixtures/1col2colFullWidthDatabase.php create mode 100644 Tests/Fixtures/container_example/Test/Fixtures/1colFullWidthDatabase.php create mode 100644 Tests/Fixtures/container_example/Test/Fixtures/3colImageFixWidthDatabase.php diff --git a/Classes/Sizes/BackendLayout/Column.php b/Classes/Sizes/BackendLayout/Column.php index 8145b33..5fdccce 100644 --- a/Classes/Sizes/BackendLayout/Column.php +++ b/Classes/Sizes/BackendLayout/Column.php @@ -30,13 +30,24 @@ class Column /** * @var float[] */ - private readonly array $multiplier; + private array $multiplier = []; + + /** + * @var int[] + */ + private array $sizes = []; public function __construct( private readonly int $identifier, array $data ) { - $this->multiplier = array_map(static fn ($multiplier): float => Multiplier::parse($multiplier), $data['multiplier']); + if (isset($data['multiplier'])) { + $this->multiplier = array_map(static fn ($multiplier): float => Multiplier::parse($multiplier), $data['multiplier']); + } + + if (isset($data['sizes'])) { + $this->sizes = array_map(static fn ($size): int => (int) $size, $data['sizes']); + } } public function getIdentifier(): int @@ -51,4 +62,12 @@ public function getMultiplier(): array { return $this->multiplier; } + + /** + * @return int[] + */ + public function getSizes(): array + { + return $this->sizes; + } } diff --git a/Classes/Sizes/Container.php b/Classes/Sizes/Container.php index 642eb8a..a1ebede 100644 --- a/Classes/Sizes/Container.php +++ b/Classes/Sizes/Container.php @@ -23,9 +23,7 @@ * 02110-1301, USA. */ -use Codappix\ResponsiveImages\Configuration\ConfigurationManager; use Codappix\ResponsiveImages\Sizes\BackendLayout\Column; -use TYPO3\CMS\Core\Utility\GeneralUtility; final class Container extends ContentElement { @@ -35,16 +33,12 @@ final class Container extends ContentElement private Column $activeColumn; - private readonly ConfigurationManager $configurationManager; - public function __construct(array $data) { parent::__construct($data); $this->layout = $data['CType']; - $this->configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class); - $this->determineColumns(); } @@ -68,6 +62,22 @@ public function getActiveColumn(): Column return $this->activeColumn; } + /** + * @return float[] + */ + public function getMultiplier(): array + { + return $this->getActiveColumn()->getMultiplier(); + } + + /** + * @return int[] + */ + public function getSizes(): array + { + return $this->getActiveColumn()->getSizes(); + } + private function determineColumns(): void { $sizesPath = implode('.', [ diff --git a/Classes/Sizes/ContentElement.php b/Classes/Sizes/ContentElement.php index 7683de5..2b55f70 100644 --- a/Classes/Sizes/ContentElement.php +++ b/Classes/Sizes/ContentElement.php @@ -23,7 +23,9 @@ * 02110-1301, USA. */ +use Codappix\ResponsiveImages\Configuration\ConfigurationManager; use TYPO3\CMS\Core\Error\Exception; +use TYPO3\CMS\Core\Utility\GeneralUtility; /** * This class represents the content elements in the rootline of the current @@ -31,17 +33,33 @@ */ class ContentElement implements ContentElementInterface { + protected readonly ConfigurationManager $configurationManager; + protected readonly string $contentType; protected readonly int $colPos; protected ContentElementInterface $parent; + /** + * @var float[] + */ + private array $multiplier = []; + + /** + * @var int[] + */ + private array $sizes = []; + public function __construct( private readonly array $data ) { + $this->configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class); + $this->contentType = $data['CType']; $this->colPos = $data['colPos']; + + $this->readConfiguration(); } public function getData(?string $dataIdentifier = null): mixed @@ -80,4 +98,39 @@ public function getParent(): ?ContentElementInterface { return $this->parent; } + + public function getSizes(): array + { + return $this->sizes; + } + + public function getMultiplier(): array + { + return $this->multiplier; + } + + public function readConfiguration(): void + { + if (get_class($this) !== self::class) { + return; + } + + $configurationPath = implode('.', [ + 'contentelements', + $this->contentType, + 'image', + ]); + + $configuration = $this->configurationManager->getByPath($configurationPath); + + if (is_array($configuration)) { + if (isset($configuration['multiplier'])) { + $this->multiplier = array_map(static fn ($multiplier): float => Multiplier::parse($multiplier), $configuration['multiplier']); + } + + if (isset($configuration['sizes'])) { + $this->sizes = array_map(static fn ($size): int => (int) $size, $configuration['sizes']); + } + } + } } diff --git a/Classes/Sizes/ContentElementInterface.php b/Classes/Sizes/ContentElementInterface.php index b931ca8..088b876 100644 --- a/Classes/Sizes/ContentElementInterface.php +++ b/Classes/Sizes/ContentElementInterface.php @@ -21,4 +21,8 @@ public function getColPos(): int; public function setParent(self $contentElement): void; public function getParent(): ?self; + + public function getSizes(): array; + + public function getMultiplier(): array; } diff --git a/Classes/Sizes/Rootline.php b/Classes/Sizes/Rootline.php index 5fe8967..a723c0b 100644 --- a/Classes/Sizes/Rootline.php +++ b/Classes/Sizes/Rootline.php @@ -55,21 +55,6 @@ public function getFinalSizes(): array return $this->finalSizes; } - public function getMultiplier(): array - { - $multiplier = [ - $this->backendLayout->getActiveColumn()->getMultiplier(), - ]; - - foreach (array_reverse($this->rootline) as $contentElement) { - if ($contentElement instanceof Container) { - $multiplier[] = $contentElement->getActiveColumn()->getMultiplier(); - } - } - - return $multiplier; - } - private function determineBackendLayout(): void { $typoscriptFrontendController = $GLOBALS['TSFE']; @@ -144,10 +129,35 @@ private function fetchContentElementFromDatabase(int $identifier): ContentElemen private function calculateSizes(): void { - $sizes = $this->backendLayout->getSizes(); + [$sizes, $multiplier] = $this->getSizesAndMultiplierFromRootline(); + + if (empty($sizes)) { + $sizes = $this->backendLayout->getSizes(); + } + + $this->calculateFinalSizes($sizes, $multiplier); + } + + private function getSizesAndMultiplierFromRootline(): array + { + $multiplier = []; + $sizes = []; + + foreach ($this->rootline as $contentElement) { + if ($contentElement instanceof ContentElement) { + $sizes = $contentElement->getSizes(); + if (!empty($sizes)) { + break; + } + $multiplier[] = $contentElement->getMultiplier(); + } + } - $multiplier = $this->getMultiplier(); + return [$sizes, $multiplier]; + } + private function calculateFinalSizes(array $sizes, array $multiplier): void + { foreach ($sizes as $sizeName => &$size) { foreach ($multiplier as $multiplierItem) { if (isset($multiplierItem[$sizeName]) === false) { diff --git a/Tests/Fixtures/base_example/Configuration/TypoScript/ContentElements/imageFixWidth.typoscript b/Tests/Fixtures/base_example/Configuration/TypoScript/ContentElements/imageFixWidth.typoscript new file mode 100644 index 0000000..7a353f9 --- /dev/null +++ b/Tests/Fixtures/base_example/Configuration/TypoScript/ContentElements/imageFixWidth.typoscript @@ -0,0 +1,36 @@ +tt_content.imageFixWidth < tt_content.image +tt_content.imageFixWidth { + templateRootPaths { + 110 = EXT:base_example/Resources/Private/Templates/FluidStyledContent + } + partialRootPaths { + 110 = EXT:base_example/Resources/Private/Partials/FluidStyledContent + } + + dataProcessing { + 20 > + 20 = Codappix\ResponsiveImages\DataProcessing\ResponsiveImagesProcessor + 20 { + fieldName = image + filesDataKey = files + } + } +} + +plugin.tx_responsiveimages { + settings { + contentelements { + imageFixWidth { + image { + sizes { + xs = 600 + sm = 900 + md = 1200 + lg = 1600 + xl = 1600 + } + } + } + } + } +} diff --git a/Tests/Fixtures/base_example/Configuration/TypoScript/Rendering.typoscript b/Tests/Fixtures/base_example/Configuration/TypoScript/Rendering.typoscript index 57404ed..9280c5b 100644 --- a/Tests/Fixtures/base_example/Configuration/TypoScript/Rendering.typoscript +++ b/Tests/Fixtures/base_example/Configuration/TypoScript/Rendering.typoscript @@ -1,2 +1,2 @@ page = PAGE -page.10 < styles.content.get \ No newline at end of file +page.10 < styles.content.get diff --git a/Tests/Fixtures/base_example/Test/Fixtures/0colImageFixWidthDatabase.php b/Tests/Fixtures/base_example/Test/Fixtures/0colImageFixWidthDatabase.php new file mode 100644 index 0000000..7912790 --- /dev/null +++ b/Tests/Fixtures/base_example/Test/Fixtures/0colImageFixWidthDatabase.php @@ -0,0 +1,32 @@ + [ + 1 => [ + 'uid' => '1', + 'pid' => '2', + 'hidden' => '0', + 'sorting' => '1', + 'CType' => 'imageFixWidth', + 'header' => 'imageFixWidth', + 'deleted' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'colPos' => '0', + 'sys_language_uid' => '0', + 'image' => '1', + ], + ], + 'sys_file_reference' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'uid_local' => '1', + 'uid_foreign' => '1', + 'tablenames' => 'tt_content', + 'fieldname' => 'image', + ], + ], +]; diff --git a/Tests/Fixtures/container_example/Configuration/TCA/Overrides/tt_content_container_1col_full_width.php b/Tests/Fixtures/container_example/Configuration/TCA/Overrides/tt_content_container_1col_full_width.php new file mode 100644 index 0000000..cb8e241 --- /dev/null +++ b/Tests/Fixtures/container_example/Configuration/TCA/Overrides/tt_content_container_1col_full_width.php @@ -0,0 +1,23 @@ +configureContainer(new ContainerConfiguration( + $cType, + '1 Column: 100', + '(100%)', + [ + [ + [ + 'name' => 'Column 101', + 'colPos' => 101, + ], + ], + ] + )); +})(); diff --git a/Tests/Fixtures/container_example/Configuration/TypoScript/Container/1col-full-witdh.typoscript b/Tests/Fixtures/container_example/Configuration/TypoScript/Container/1col-full-witdh.typoscript new file mode 100644 index 0000000..2c9ad84 --- /dev/null +++ b/Tests/Fixtures/container_example/Configuration/TypoScript/Container/1col-full-witdh.typoscript @@ -0,0 +1,22 @@ +plugin.tx_responsiveimages { + settings { + example_container-1col-full-width { + columns { + 101 { + sizes { + xs = 1254 + sm = 1203 + md = 1578 + lg = 1920 + xl = 1920 + } + } + } + } + } +} + +tt_content.example_container-1col-full-width < lib.containerElement +tt_content.example_container-1col-full-width { + templateName = 1col +} diff --git a/Tests/Fixtures/container_example/Test/Fixtures/0colImageFixWidthDatabase.php b/Tests/Fixtures/container_example/Test/Fixtures/0colImageFixWidthDatabase.php new file mode 100644 index 0000000..5503ce6 --- /dev/null +++ b/Tests/Fixtures/container_example/Test/Fixtures/0colImageFixWidthDatabase.php @@ -0,0 +1,33 @@ + [ + 1 => [ + 'uid' => '1', + 'pid' => '2', + 'hidden' => '0', + 'sorting' => '1', + 'CType' => 'imageFixWidth', + 'header' => 'imageFixWidth', + 'deleted' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'colPos' => '0', + 'sys_language_uid' => '0', + 'image' => '1', + 'tx_container_parent' => '0', + ], + ], + 'sys_file_reference' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'uid_local' => '1', + 'uid_foreign' => '1', + 'tablenames' => 'tt_content', + 'fieldname' => 'image', + ], + ], +]; diff --git a/Tests/Fixtures/container_example/Test/Fixtures/1col2colFullWidthDatabase.php b/Tests/Fixtures/container_example/Test/Fixtures/1col2colFullWidthDatabase.php new file mode 100644 index 0000000..f194339 --- /dev/null +++ b/Tests/Fixtures/container_example/Test/Fixtures/1col2colFullWidthDatabase.php @@ -0,0 +1,61 @@ + [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'hidden' => '0', + 'sorting' => '1', + 'CType' => 'example_container-1col-full-width', + 'header' => '1col', + 'deleted' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'colPos' => '0', + 'sys_language_uid' => '0', + 'tx_container_parent' => '0', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'hidden' => '0', + 'sorting' => '1', + 'CType' => 'example_container-2col-50-50', + 'header' => '2col in 2col', + 'deleted' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'colPos' => '101', + 'sys_language_uid' => '0', + 'tx_container_parent' => '1', + ], + 2 => [ + 'uid' => '3', + 'pid' => '2', + 'hidden' => '0', + 'sorting' => '1', + 'CType' => 'image', + 'header' => 'image in 2col in 1col', + 'deleted' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'colPos' => '102', + 'sys_language_uid' => '0', + 'image' => '1', + 'tx_container_parent' => '2', + ], + ], + 'sys_file_reference' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'uid_local' => '1', + 'uid_foreign' => '3', + 'tablenames' => 'tt_content', + 'fieldname' => 'image', + ], + ], +]; diff --git a/Tests/Fixtures/container_example/Test/Fixtures/1colFullWidthDatabase.php b/Tests/Fixtures/container_example/Test/Fixtures/1colFullWidthDatabase.php new file mode 100644 index 0000000..1f608a5 --- /dev/null +++ b/Tests/Fixtures/container_example/Test/Fixtures/1colFullWidthDatabase.php @@ -0,0 +1,47 @@ + [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'hidden' => '0', + 'sorting' => '1', + 'CType' => 'example_container-1col-full-width', + 'header' => '1col', + 'deleted' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'colPos' => '0', + 'sys_language_uid' => '0', + 'tx_container_parent' => '0', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'hidden' => '0', + 'sorting' => '1', + 'CType' => 'image', + 'header' => 'image in 1col', + 'deleted' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'colPos' => '101', + 'sys_language_uid' => '0', + 'image' => '1', + 'tx_container_parent' => '1', + ], + ], + 'sys_file_reference' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'uid_local' => '1', + 'uid_foreign' => '2', + 'tablenames' => 'tt_content', + 'fieldname' => 'image', + ], + ], +]; diff --git a/Tests/Fixtures/container_example/Test/Fixtures/3colImageFixWidthDatabase.php b/Tests/Fixtures/container_example/Test/Fixtures/3colImageFixWidthDatabase.php new file mode 100644 index 0000000..5167e74 --- /dev/null +++ b/Tests/Fixtures/container_example/Test/Fixtures/3colImageFixWidthDatabase.php @@ -0,0 +1,47 @@ + [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'hidden' => '0', + 'sorting' => '1', + 'CType' => 'example_container-3col', + 'header' => '3col', + 'deleted' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'colPos' => '0', + 'sys_language_uid' => '0', + 'tx_container_parent' => '0', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'hidden' => '0', + 'sorting' => '1', + 'CType' => 'imageFixWidth', + 'header' => 'imageFixWidth in 3col', + 'deleted' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'colPos' => '101', + 'sys_language_uid' => '0', + 'image' => '1', + 'tx_container_parent' => '1', + ], + ], + 'sys_file_reference' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'uid_local' => '1', + 'uid_foreign' => '2', + 'tablenames' => 'tt_content', + 'fieldname' => 'image', + ], + ], +]; diff --git a/Tests/Functional/BaseTest.php b/Tests/Functional/BaseTest.php index 6177aae..36075e0 100644 --- a/Tests/Functional/BaseTest.php +++ b/Tests/Functional/BaseTest.php @@ -72,6 +72,16 @@ public static function imageScalingValuesDataProvider(): iterable '4' => 'large 1124 (min-width: 1480px)', ], ]; + yield '0 Column with ImageFixWidth' => [ + '0colImageFixWidthDatabase.php', + [ + '0' => 'mobile 600 (max-width: 480px)', + '1' => 'mobile 900 (max-width: 767px)', + '2' => 'tablet 1200 (max-width: 991px)', + '3' => 'default 1600 (max-width: 1479px)', + '4' => 'large 1600 (min-width: 1480px)', + ], + ]; } #[Test] diff --git a/Tests/Functional/ContainerTest.php b/Tests/Functional/ContainerTest.php index abc56ef..f305818 100644 --- a/Tests/Functional/ContainerTest.php +++ b/Tests/Functional/ContainerTest.php @@ -135,6 +135,46 @@ public static function imageScalingValuesDataProvider(): iterable '4' => 'large 374.292 (min-width: 1480px)', ], ]; + yield '1 Column Full Width' => [ + '1colFullWidthDatabase.php', + [ + '0' => 'mobile 1254 (max-width: 480px)', + '1' => 'mobile 1203 (max-width: 767px)', + '2' => 'tablet 1578 (max-width: 991px)', + '3' => 'default 1920 (max-width: 1479px)', + '4' => 'large 1920 (min-width: 1480px)', + ], + ]; + yield '2 Column in 1 Column Full Width' => [ + '1col2colFullWidthDatabase.php', + [ + '0' => 'mobile 1254 (max-width: 480px)', + '1' => 'mobile 1203 (max-width: 767px)', + '2' => 'tablet 789 (max-width: 991px)', + '3' => 'default 960 (max-width: 1479px)', + '4' => 'large 960 (min-width: 1480px)', + ], + ]; + yield '0 Column with ImageFixWidth' => [ + '0colImageFixWidthDatabase.php', + [ + '0' => 'mobile 600 (max-width: 480px)', + '1' => 'mobile 900 (max-width: 767px)', + '2' => 'tablet 1200 (max-width: 991px)', + '3' => 'default 1600 (max-width: 1479px)', + '4' => 'large 1600 (min-width: 1480px)', + ], + ]; + yield '3 Column with ImageFixWidth' => [ + '3colImageFixWidthDatabase.php', + [ + '0' => 'mobile 600 (max-width: 480px)', + '1' => 'mobile 900 (max-width: 767px)', + '2' => 'tablet 1200 (max-width: 991px)', + '3' => 'default 1600 (max-width: 1479px)', + '4' => 'large 1600 (min-width: 1480px)', + ], + ]; } #[Test] From 6797fd15bf4e670d2c4d153622d4dbd5d10ca8f3 Mon Sep 17 00:00:00 2001 From: Justus Moroni Date: Wed, 3 Apr 2024 11:53:33 +0200 Subject: [PATCH 2/6] chore: Fix calculation Adjust test to container content element that modifies the size of an image. --- .../ResponsiveImagesProcessor.php | 51 +------------------ .../ContentElements/image.typoscript | 2 +- Tests/Functional/BaseTest.php | 2 +- Tests/Functional/ContainerTest.php | 18 +++---- 4 files changed, 12 insertions(+), 61 deletions(-) diff --git a/Classes/DataProcessing/ResponsiveImagesProcessor.php b/Classes/DataProcessing/ResponsiveImagesProcessor.php index fdb38ba..9136aaa 100644 --- a/Classes/DataProcessing/ResponsiveImagesProcessor.php +++ b/Classes/DataProcessing/ResponsiveImagesProcessor.php @@ -25,9 +25,7 @@ use Codappix\ResponsiveImages\Configuration\ConfigurationManager; use Codappix\ResponsiveImages\Sizes\Breakpoint; -use Codappix\ResponsiveImages\Sizes\Multiplier; use Codappix\ResponsiveImages\Sizes\Rootline; -use TYPO3\CMS\Core\Error\Exception; use TYPO3\CMS\Core\Resource\FileInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; @@ -37,11 +35,6 @@ final class ResponsiveImagesProcessor implements DataProcessorInterface { private readonly ConfigurationManager $configurationManager; - /** - * The processor configuration - */ - private array $processorConfiguration; - /** * @var FileInterface[] */ @@ -49,12 +42,8 @@ final class ResponsiveImagesProcessor implements DataProcessorInterface private array $calculatedFiles = []; - private array $contentElementData = []; - private array $contentElementSizes = []; - private array $contentElementFieldConfiguration = []; - public function __construct() { $this->configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class); @@ -69,8 +58,6 @@ public function process( if (isset($processorConfiguration['if.']) && !$cObj->checkIf($processorConfiguration['if.'])) { return $processedData; } - $this->processorConfiguration = $processorConfiguration; - $this->contentElementData = $processedData['data']; $filesDataKey = (string) $cObj->stdWrapValue( 'filesDataKey', @@ -85,7 +72,6 @@ public function process( } $this->contentElementSizes = (new Rootline($processedData['data']))->getFinalSizes(); - $this->fetchContentElementFieldConfiguration(); $this->calculateFileDimensions(); $targetFieldName = (string) $cObj->stdWrapValue( @@ -99,23 +85,6 @@ public function process( return $processedData; } - private function fetchContentElementFieldConfiguration(): void - { - $contentElementFieldPath = implode('.', [ - 'contentelements', - $this->contentElementData['CType'], - $this->processorConfiguration['fieldName'], - ]); - - if ($this->configurationManager->isValidPath($contentElementFieldPath) === false) { - throw new Exception("Field configuration '" . $contentElementFieldPath . "' missing."); - } - - if (is_array($this->configurationManager->getByPath($contentElementFieldPath))) { - $this->contentElementFieldConfiguration = $this->configurationManager->getByPath($contentElementFieldPath); - } - } - private function calculateFileDimensions(): void { foreach ($this->files as $file) { @@ -131,7 +100,6 @@ private function calculateFileDimensions(): void private function calculateFileDimensionForBreakpoints(): array { $fileDimensions = []; - $fieldConfiguration = $this->contentElementFieldConfiguration; $breakpoints = $this->getBreakpoints(); @@ -141,27 +109,10 @@ private function calculateFileDimensionForBreakpoints(): array continue; } - $contentElementSize = $this->contentElementSizes[$breakpoint->getIdentifier()]; $fileDimensions[$breakpoint->getIdentifier()] = [ 'breakpoint' => $breakpoint, + 'size' => $this->contentElementSizes[$breakpoint->getIdentifier()], ]; - - if (isset($fieldConfiguration['multiplier'])) { - $fileDimensions[$breakpoint->getIdentifier()]['size'] = $contentElementSize - * Multiplier::parse( - $fieldConfiguration['multiplier'][$breakpoint->getIdentifier()] - ); - - continue; - } - - if (isset($fieldConfiguration['sizes'])) { - $fileDimensions[$breakpoint->getIdentifier()]['size'] = Multiplier::parse( - $fieldConfiguration['sizes'][$breakpoint->getIdentifier()] - ); - - continue; - } } return $fileDimensions; diff --git a/Tests/Fixtures/base_example/Configuration/TypoScript/ContentElements/image.typoscript b/Tests/Fixtures/base_example/Configuration/TypoScript/ContentElements/image.typoscript index 3c2b33a..5a72e4f 100644 --- a/Tests/Fixtures/base_example/Configuration/TypoScript/ContentElements/image.typoscript +++ b/Tests/Fixtures/base_example/Configuration/TypoScript/ContentElements/image.typoscript @@ -26,7 +26,7 @@ plugin.tx_responsiveimages { sm = 1 md = 1 lg = 1 - xl = 1 + xl = 0.5 } } } diff --git a/Tests/Functional/BaseTest.php b/Tests/Functional/BaseTest.php index 36075e0..dcc5177 100644 --- a/Tests/Functional/BaseTest.php +++ b/Tests/Functional/BaseTest.php @@ -69,7 +69,7 @@ public static function imageScalingValuesDataProvider(): iterable '1' => 'mobile 704 (max-width: 767px)', '2' => 'tablet 924 (max-width: 991px)', '3' => 'default 1124 (max-width: 1479px)', - '4' => 'large 1124 (min-width: 1480px)', + '4' => 'large 562 (min-width: 1480px)', ], ]; yield '0 Column with ImageFixWidth' => [ diff --git a/Tests/Functional/ContainerTest.php b/Tests/Functional/ContainerTest.php index f305818..93e0f91 100644 --- a/Tests/Functional/ContainerTest.php +++ b/Tests/Functional/ContainerTest.php @@ -72,7 +72,7 @@ public static function imageScalingValuesDataProvider(): iterable '1' => 'mobile 704 (max-width: 767px)', '2' => 'tablet 924 (max-width: 991px)', '3' => 'default 1124 (max-width: 1479px)', - '4' => 'large 1124 (min-width: 1480px)', + '4' => 'large 562 (min-width: 1480px)', ], ]; yield '1 Column' => [ @@ -82,7 +82,7 @@ public static function imageScalingValuesDataProvider(): iterable '1' => 'mobile 704 (max-width: 767px)', '2' => 'tablet 924 (max-width: 991px)', '3' => 'default 1124 (max-width: 1479px)', - '4' => 'large 1124 (min-width: 1480px)', + '4' => 'large 562 (min-width: 1480px)', ], ]; yield '2 Column 50-50' => [ @@ -92,7 +92,7 @@ public static function imageScalingValuesDataProvider(): iterable '1' => 'mobile 704 (max-width: 767px)', '2' => 'tablet 462 (max-width: 991px)', '3' => 'default 562 (max-width: 1479px)', - '4' => 'large 562 (min-width: 1480px)', + '4' => 'large 281 (min-width: 1480px)', ], ]; yield '2 Column 66-33' => [ @@ -102,7 +102,7 @@ public static function imageScalingValuesDataProvider(): iterable '1' => 'mobile 704 (max-width: 767px)', '2' => 'tablet 615.384 (max-width: 991px)', '3' => 'default 748.584 (max-width: 1479px)', - '4' => 'large 748.584 (min-width: 1480px)', + '4' => 'large 374.292 (min-width: 1480px)', ], ]; yield '2 Column in 1 Column' => [ @@ -112,7 +112,7 @@ public static function imageScalingValuesDataProvider(): iterable '1' => 'mobile 704 (max-width: 767px)', '2' => 'tablet 462 (max-width: 991px)', '3' => 'default 562 (max-width: 1479px)', - '4' => 'large 562 (min-width: 1480px)', + '4' => 'large 281 (min-width: 1480px)', ], ]; yield '2 Column in 2 Column' => [ @@ -122,7 +122,7 @@ public static function imageScalingValuesDataProvider(): iterable '1' => 'mobile 704 (max-width: 767px)', '2' => 'tablet 231 (max-width: 991px)', '3' => 'default 281 (max-width: 1479px)', - '4' => 'large 281 (min-width: 1480px)', + '4' => 'large 140.5 (min-width: 1480px)', ], ]; yield '3 Column' => [ @@ -132,7 +132,7 @@ public static function imageScalingValuesDataProvider(): iterable '1' => 'mobile 704 (max-width: 767px)', '2' => 'tablet 307.692 (max-width: 991px)', '3' => 'default 374.292 (max-width: 1479px)', - '4' => 'large 374.292 (min-width: 1480px)', + '4' => 'large 187.146 (min-width: 1480px)', ], ]; yield '1 Column Full Width' => [ @@ -142,7 +142,7 @@ public static function imageScalingValuesDataProvider(): iterable '1' => 'mobile 1203 (max-width: 767px)', '2' => 'tablet 1578 (max-width: 991px)', '3' => 'default 1920 (max-width: 1479px)', - '4' => 'large 1920 (min-width: 1480px)', + '4' => 'large 960 (min-width: 1480px)', ], ]; yield '2 Column in 1 Column Full Width' => [ @@ -152,7 +152,7 @@ public static function imageScalingValuesDataProvider(): iterable '1' => 'mobile 1203 (max-width: 767px)', '2' => 'tablet 789 (max-width: 991px)', '3' => 'default 960 (max-width: 1479px)', - '4' => 'large 960 (min-width: 1480px)', + '4' => 'large 480 (min-width: 1480px)', ], ]; yield '0 Column with ImageFixWidth' => [ From 682788ea5bc6439293af4c6f82ea28c6241b256a Mon Sep 17 00:00:00 2001 From: Daniel Gohlke Date: Wed, 3 Apr 2024 16:55:14 +0200 Subject: [PATCH 3/6] BUGFIX: Replace static string with data processor configuration --- .../ResponsiveImagesProcessor.php | 7 +- Classes/Sizes/AbstractContentElement.php | 87 +++++++++++++++++++ Classes/Sizes/Container.php | 8 +- Classes/Sizes/ContentElement.php | 69 ++------------- Classes/Sizes/ContentElementInterface.php | 2 - Classes/Sizes/Rootline.php | 17 ++-- 6 files changed, 110 insertions(+), 80 deletions(-) create mode 100644 Classes/Sizes/AbstractContentElement.php diff --git a/Classes/DataProcessing/ResponsiveImagesProcessor.php b/Classes/DataProcessing/ResponsiveImagesProcessor.php index 9136aaa..0bd0407 100644 --- a/Classes/DataProcessing/ResponsiveImagesProcessor.php +++ b/Classes/DataProcessing/ResponsiveImagesProcessor.php @@ -64,6 +64,11 @@ public function process( $processorConfiguration, 'files' ); + $filesName = (string) $cObj->stdWrapValue( + 'fieldName', + $processorConfiguration, + 'image' + ); if (isset($processedData[$filesDataKey]) && is_array($processedData[$filesDataKey])) { $this->files = $processedData[$filesDataKey]; } else { @@ -71,7 +76,7 @@ public function process( return $processedData; } - $this->contentElementSizes = (new Rootline($processedData['data']))->getFinalSizes(); + $this->contentElementSizes = (new Rootline($processedData['data'], $filesName))->getFinalSizes(); $this->calculateFileDimensions(); $targetFieldName = (string) $cObj->stdWrapValue( diff --git a/Classes/Sizes/AbstractContentElement.php b/Classes/Sizes/AbstractContentElement.php new file mode 100644 index 0000000..71330e0 --- /dev/null +++ b/Classes/Sizes/AbstractContentElement.php @@ -0,0 +1,87 @@ + + * + * This program 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. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +use Codappix\ResponsiveImages\Configuration\ConfigurationManager; +use Exception; +use TYPO3\CMS\Core\Utility\GeneralUtility; + +abstract class AbstractContentElement implements ContentElementInterface +{ + protected ConfigurationManager $configurationManager; + + protected int $colPos; + + protected string $contentType; + + protected array $data; + + protected ContentElementInterface $parent; + + public function __construct(array $data) + { + $this->configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class); + + $this->contentType = $data['CType']; + $this->colPos = $data['colPos']; + $this->data = $data; + } + + public function getData(?string $dataIdentifier = null): mixed + { + if ($dataIdentifier === null) { + return $this->data; + } + + if (isset($this->data[$dataIdentifier]) === false) { + throw new Exception('No data found for key ' . $dataIdentifier . ' in $this->data.'); + } + + return $this->data[$dataIdentifier]; + } + + public function getColPos(): int + { + return $this->colPos; + } + + public function getContentType(): string + { + return $this->contentType; + } + + public function getParent(): ?ContentElementInterface + { + return $this->parent; + } + + public function setParent(ContentElementInterface $contentElement): void + { + if ($contentElement instanceof Container) { + $contentElement->setActiveColumn($contentElement->getColumn($this->colPos)); + } + + $this->parent = $contentElement; + } +} diff --git a/Classes/Sizes/Container.php b/Classes/Sizes/Container.php index a1ebede..3917a89 100644 --- a/Classes/Sizes/Container.php +++ b/Classes/Sizes/Container.php @@ -25,10 +25,8 @@ use Codappix\ResponsiveImages\Sizes\BackendLayout\Column; -final class Container extends ContentElement +final class Container extends AbstractContentElement { - private readonly string $layout; - private array $columns = []; private Column $activeColumn; @@ -37,8 +35,6 @@ public function __construct(array $data) { parent::__construct($data); - $this->layout = $data['CType']; - $this->determineColumns(); } @@ -81,7 +77,7 @@ public function getSizes(): array private function determineColumns(): void { $sizesPath = implode('.', [ - $this->layout, + $this->contentType, 'columns', ]); diff --git a/Classes/Sizes/ContentElement.php b/Classes/Sizes/ContentElement.php index 2b55f70..8d495ae 100644 --- a/Classes/Sizes/ContentElement.php +++ b/Classes/Sizes/ContentElement.php @@ -23,24 +23,8 @@ * 02110-1301, USA. */ -use Codappix\ResponsiveImages\Configuration\ConfigurationManager; -use TYPO3\CMS\Core\Error\Exception; -use TYPO3\CMS\Core\Utility\GeneralUtility; - -/** - * This class represents the content elements in the rootline of the current - * content element which is rendered. - */ -class ContentElement implements ContentElementInterface +class ContentElement extends AbstractContentElement { - protected readonly ConfigurationManager $configurationManager; - - protected readonly string $contentType; - - protected readonly int $colPos; - - protected ContentElementInterface $parent; - /** * @var float[] */ @@ -52,53 +36,14 @@ class ContentElement implements ContentElementInterface private array $sizes = []; public function __construct( - private readonly array $data + array $data, + private readonly string $fieldName ) { - $this->configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class); - - $this->contentType = $data['CType']; - $this->colPos = $data['colPos']; + parent::__construct($data); $this->readConfiguration(); } - public function getData(?string $dataIdentifier = null): mixed - { - if ($dataIdentifier === null) { - return $this->data; - } - - if (isset($this->data[$dataIdentifier]) === false) { - throw new Exception('No data found for key ' . $dataIdentifier . ' in $this->data.'); - } - - return $this->data[$dataIdentifier]; - } - - public function getContentType(): string - { - return $this->contentType; - } - - public function getColPos(): int - { - return $this->colPos; - } - - public function setParent(ContentElementInterface $contentElement): void - { - if ($contentElement instanceof Container) { - $contentElement->setActiveColumn($contentElement->getColumn($this->colPos)); - } - - $this->parent = $contentElement; - } - - public function getParent(): ?ContentElementInterface - { - return $this->parent; - } - public function getSizes(): array { return $this->sizes; @@ -111,14 +56,10 @@ public function getMultiplier(): array public function readConfiguration(): void { - if (get_class($this) !== self::class) { - return; - } - $configurationPath = implode('.', [ 'contentelements', $this->contentType, - 'image', + $this->fieldName, ]); $configuration = $this->configurationManager->getByPath($configurationPath); diff --git a/Classes/Sizes/ContentElementInterface.php b/Classes/Sizes/ContentElementInterface.php index 088b876..12842bb 100644 --- a/Classes/Sizes/ContentElementInterface.php +++ b/Classes/Sizes/ContentElementInterface.php @@ -10,8 +10,6 @@ */ interface ContentElementInterface { - public function __construct(array $data); - public function getData(?string $dataIdentifier = null): mixed; public function getContentType(): string; diff --git a/Classes/Sizes/Rootline.php b/Classes/Sizes/Rootline.php index a723c0b..8ca85b3 100644 --- a/Classes/Sizes/Rootline.php +++ b/Classes/Sizes/Rootline.php @@ -41,9 +41,12 @@ final class Rootline private array $finalSizes = []; - public function __construct(array $data) + private string $fieldName; + + public function __construct(array $data, string $fieldName) { $this->determineBackendLayout(); + $this->fieldName = $fieldName; $this->contentElement = $this->determineContentElement($data); $this->determineRootline(); @@ -72,7 +75,7 @@ private function determineContentElement(array $data): ContentElementInterface return new Container($data); } - return new ContentElement($data); + return new ContentElement($data, $this->fieldName); } private function determineRootline(): void @@ -131,10 +134,6 @@ private function calculateSizes(): void { [$sizes, $multiplier] = $this->getSizesAndMultiplierFromRootline(); - if (empty($sizes)) { - $sizes = $this->backendLayout->getSizes(); - } - $this->calculateFinalSizes($sizes, $multiplier); } @@ -144,7 +143,7 @@ private function getSizesAndMultiplierFromRootline(): array $sizes = []; foreach ($this->rootline as $contentElement) { - if ($contentElement instanceof ContentElement) { + if ($contentElement instanceof ContentElementInterface) { $sizes = $contentElement->getSizes(); if (!empty($sizes)) { break; @@ -153,6 +152,10 @@ private function getSizesAndMultiplierFromRootline(): array } } + if (empty($sizes)) { + $sizes = $this->backendLayout->getSizes(); + } + return [$sizes, $multiplier]; } From 93d3b44b2da3f8b6a40c2177cbd1760e227dd18f Mon Sep 17 00:00:00 2001 From: Daniel Gohlke Date: Wed, 3 Apr 2024 17:07:23 +0200 Subject: [PATCH 4/6] CLEANUP: Wrap TypoScript configuration with container Content elements are also wrapped in resonsive image configuration with "contentelements". --- Classes/Sizes/Container.php | 1 + .../Container/1col-full-witdh.typoscript | 20 +++---- .../TypoScript/Container/1col.typoscript | 20 +++---- .../Container/2col-33-66.typoscript | 36 +++++++------ .../Container/2col-50-50.typoscript | 36 +++++++------ .../Container/2col-66-33.typoscript | 36 +++++++------ .../TypoScript/Container/3col.typoscript | 52 ++++++++++--------- 7 files changed, 107 insertions(+), 94 deletions(-) diff --git a/Classes/Sizes/Container.php b/Classes/Sizes/Container.php index 3917a89..3d7e590 100644 --- a/Classes/Sizes/Container.php +++ b/Classes/Sizes/Container.php @@ -77,6 +77,7 @@ public function getSizes(): array private function determineColumns(): void { $sizesPath = implode('.', [ + 'container', $this->contentType, 'columns', ]); diff --git a/Tests/Fixtures/container_example/Configuration/TypoScript/Container/1col-full-witdh.typoscript b/Tests/Fixtures/container_example/Configuration/TypoScript/Container/1col-full-witdh.typoscript index 2c9ad84..fde8aae 100644 --- a/Tests/Fixtures/container_example/Configuration/TypoScript/Container/1col-full-witdh.typoscript +++ b/Tests/Fixtures/container_example/Configuration/TypoScript/Container/1col-full-witdh.typoscript @@ -1,14 +1,16 @@ plugin.tx_responsiveimages { settings { - example_container-1col-full-width { - columns { - 101 { - sizes { - xs = 1254 - sm = 1203 - md = 1578 - lg = 1920 - xl = 1920 + container { + example_container-1col-full-width { + columns { + 101 { + sizes { + xs = 1254 + sm = 1203 + md = 1578 + lg = 1920 + xl = 1920 + } } } } diff --git a/Tests/Fixtures/container_example/Configuration/TypoScript/Container/1col.typoscript b/Tests/Fixtures/container_example/Configuration/TypoScript/Container/1col.typoscript index e77c473..6359bd0 100644 --- a/Tests/Fixtures/container_example/Configuration/TypoScript/Container/1col.typoscript +++ b/Tests/Fixtures/container_example/Configuration/TypoScript/Container/1col.typoscript @@ -1,14 +1,16 @@ plugin.tx_responsiveimages { settings { - example_container-1col { - columns { - 101 { - multiplier { - xs = 1 - sm = 1 - md = 1 - lg = 1 - xl = 1 + container { + example_container-1col { + columns { + 101 { + multiplier { + xs = 1 + sm = 1 + md = 1 + lg = 1 + xl = 1 + } } } } diff --git a/Tests/Fixtures/container_example/Configuration/TypoScript/Container/2col-33-66.typoscript b/Tests/Fixtures/container_example/Configuration/TypoScript/Container/2col-33-66.typoscript index 233ecad..789c1d7 100644 --- a/Tests/Fixtures/container_example/Configuration/TypoScript/Container/2col-33-66.typoscript +++ b/Tests/Fixtures/container_example/Configuration/TypoScript/Container/2col-33-66.typoscript @@ -1,24 +1,26 @@ plugin.tx_responsiveimages { settings { - example_container-2col-33-66 { - columns { - 101 { - multiplier { - xs = 1 - sm = 1 - md = 0,333 - lg = 0,333 - xl = 0,333 + container { + example_container-2col-33-66 { + columns { + 101 { + multiplier { + xs = 1 + sm = 1 + md = 0,333 + lg = 0,333 + xl = 0,333 + } } - } - 102 { - multiplier { - xs = 1 - sm = 1 - md = 0,666 - lg = 0,666 - xl = 0,666 + 102 { + multiplier { + xs = 1 + sm = 1 + md = 0,666 + lg = 0,666 + xl = 0,666 + } } } } diff --git a/Tests/Fixtures/container_example/Configuration/TypoScript/Container/2col-50-50.typoscript b/Tests/Fixtures/container_example/Configuration/TypoScript/Container/2col-50-50.typoscript index 451eb67..33a760c 100644 --- a/Tests/Fixtures/container_example/Configuration/TypoScript/Container/2col-50-50.typoscript +++ b/Tests/Fixtures/container_example/Configuration/TypoScript/Container/2col-50-50.typoscript @@ -1,24 +1,26 @@ plugin.tx_responsiveimages { settings { - example_container-2col-50-50 { - columns { - 101 { - multiplier { - xs = 1 - sm = 1 - md = 0,5 - lg = 0,5 - xl = 0,5 + container { + example_container-2col-50-50 { + columns { + 101 { + multiplier { + xs = 1 + sm = 1 + md = 0,5 + lg = 0,5 + xl = 0,5 + } } - } - 102 { - multiplier { - xs = 1 - sm = 1 - md = 0,5 - lg = 0,5 - xl = 0,5 + 102 { + multiplier { + xs = 1 + sm = 1 + md = 0,5 + lg = 0,5 + xl = 0,5 + } } } } diff --git a/Tests/Fixtures/container_example/Configuration/TypoScript/Container/2col-66-33.typoscript b/Tests/Fixtures/container_example/Configuration/TypoScript/Container/2col-66-33.typoscript index 68375a5..4266f20 100644 --- a/Tests/Fixtures/container_example/Configuration/TypoScript/Container/2col-66-33.typoscript +++ b/Tests/Fixtures/container_example/Configuration/TypoScript/Container/2col-66-33.typoscript @@ -1,24 +1,26 @@ plugin.tx_responsiveimages { settings { - example_container-2col-66-33 { - columns { - 101 { - multiplier { - xs = 1 - sm = 1 - md = 0,666 - lg = 0,666 - xl = 0,666 + container { + example_container-2col-66-33 { + columns { + 101 { + multiplier { + xs = 1 + sm = 1 + md = 0,666 + lg = 0,666 + xl = 0,666 + } } - } - 102 { - multiplier { - xs = 1 - sm = 1 - md = 0,333 - lg = 0,333 - xl = 0,333 + 102 { + multiplier { + xs = 1 + sm = 1 + md = 0,333 + lg = 0,333 + xl = 0,333 + } } } } diff --git a/Tests/Fixtures/container_example/Configuration/TypoScript/Container/3col.typoscript b/Tests/Fixtures/container_example/Configuration/TypoScript/Container/3col.typoscript index 9cf6190..2a283ea 100644 --- a/Tests/Fixtures/container_example/Configuration/TypoScript/Container/3col.typoscript +++ b/Tests/Fixtures/container_example/Configuration/TypoScript/Container/3col.typoscript @@ -1,34 +1,36 @@ plugin.tx_responsiveimages { settings { - example_container-3col { - columns { - 101 { - multiplier { - xs = 1 - sm = 1 - md = 0,333 - lg = 0,333 - xl = 0,333 + container { + example_container-3col { + columns { + 101 { + multiplier { + xs = 1 + sm = 1 + md = 0,333 + lg = 0,333 + xl = 0,333 + } } - } - 102 { - multiplier { - xs = 1 - sm = 1 - md = 0,333 - lg = 0,333 - xl = 0,333 + 102 { + multiplier { + xs = 1 + sm = 1 + md = 0,333 + lg = 0,333 + xl = 0,333 + } } - } - 103 { - multiplier { - xs = 1 - sm = 1 - md = 0,333 - lg = 0,333 - xl = 0,333 + 103 { + multiplier { + xs = 1 + sm = 1 + md = 0,333 + lg = 0,333 + xl = 0,333 + } } } } From fa4af9a0245b0cadba46fa1deab263baa725e0e7 Mon Sep 17 00:00:00 2001 From: Justus Moroni <5197489+justusmoroni@users.noreply.github.com> Date: Wed, 3 Apr 2024 17:18:37 +0200 Subject: [PATCH 5/6] Update Classes/DataProcessing/ResponsiveImagesProcessor.php --- Classes/DataProcessing/ResponsiveImagesProcessor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/DataProcessing/ResponsiveImagesProcessor.php b/Classes/DataProcessing/ResponsiveImagesProcessor.php index 0bd0407..16a7e77 100644 --- a/Classes/DataProcessing/ResponsiveImagesProcessor.php +++ b/Classes/DataProcessing/ResponsiveImagesProcessor.php @@ -64,7 +64,7 @@ public function process( $processorConfiguration, 'files' ); - $filesName = (string) $cObj->stdWrapValue( + $fieldName = (string) $cObj->stdWrapValue( 'fieldName', $processorConfiguration, 'image' From 57d156e672f5ff3fc7e3f0542f875eac1eaea028 Mon Sep 17 00:00:00 2001 From: Justus Moroni <5197489+justusmoroni@users.noreply.github.com> Date: Wed, 3 Apr 2024 17:18:42 +0200 Subject: [PATCH 6/6] Update Classes/DataProcessing/ResponsiveImagesProcessor.php --- Classes/DataProcessing/ResponsiveImagesProcessor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/DataProcessing/ResponsiveImagesProcessor.php b/Classes/DataProcessing/ResponsiveImagesProcessor.php index 16a7e77..0d4dc8b 100644 --- a/Classes/DataProcessing/ResponsiveImagesProcessor.php +++ b/Classes/DataProcessing/ResponsiveImagesProcessor.php @@ -76,7 +76,7 @@ public function process( return $processedData; } - $this->contentElementSizes = (new Rootline($processedData['data'], $filesName))->getFinalSizes(); + $this->contentElementSizes = (new Rootline($processedData['data'], $fieldName))->getFinalSizes(); $this->calculateFileDimensions(); $targetFieldName = (string) $cObj->stdWrapValue(