diff --git a/typo3/sysext/backend/Resources/Private/Templates/ImageManipulation/ImageManipulationElement.html b/typo3/sysext/backend/Resources/Private/Templates/ImageManipulation/ImageManipulationElement.html index 9f217438b161cbbf973a2f205388c705e37ca7cc..1644a76150cff64f4773da5ccb2d866a86a1f265 100644 --- a/typo3/sysext/backend/Resources/Private/Templates/ImageManipulation/ImageManipulationElement.html +++ b/typo3/sysext/backend/Resources/Private/Templates/ImageManipulation/ImageManipulationElement.html @@ -32,7 +32,7 @@ <div class="col-xs-6 col-sm-4 col-md-3 media-gallery__item"> <p> <b><f:translate id="{cropVariant.title}" default="{cropVariant.title}" /></b><br/> - <f:translate id="LLL:EXT:lang/Resources/Private/Language/locallang_wizards.xlf:imwizard.aspect-ratio"/>: {cropVariant.selectedRatioTitle} + <f:translate id="LLL:EXT:lang/Resources/Private/Language/locallang_wizards.xlf:imwizard.aspect-ratio"/>: <f:translate id="{cropVariant.allowedAspectRatios.{cropVariant.selectedRatio}.title}" default="{cropVariant.allowedAspectRatios.{cropVariant.selectedRatio}.title}" /> </p> <div class="t3js-image-manipulation-preview media-object" data-preview-height="150" diff --git a/typo3/sysext/fluid/Classes/Core/Variables/CmsVariableProvider.php b/typo3/sysext/fluid/Classes/Core/Variables/CmsVariableProvider.php index 2301791b9af0e02df07469632febc90f2bcc29de..1f005c9909b4efe11abc0454164d2a38a229f86a 100644 --- a/typo3/sysext/fluid/Classes/Core/Variables/CmsVariableProvider.php +++ b/typo3/sysext/fluid/Classes/Core/Variables/CmsVariableProvider.php @@ -32,6 +32,23 @@ class CmsVariableProvider extends \TYPO3Fluid\Fluid\Core\Variables\StandardVaria */ public function getByPath($path, array $accessors = []) { + $path = $this->resolveSubVariableReferences($path); return \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getPropertyPath($this->variables, $path); } + + /** + * @param string $propertyPath + * @return string + */ + protected function resolveSubVariableReferences($propertyPath) + { + if (strpos($propertyPath, '{') !== false) { + preg_match_all('/(\{.*\})/', $propertyPath, $matches); + foreach ($matches[1] as $match) { + $subPropertyPath = substr($match, 1, -1); + $propertyPath = str_replace($match, $this->getByPath($subPropertyPath), $propertyPath); + } + } + return $propertyPath; + } } diff --git a/typo3/sysext/fluid/Tests/Unit/Core/Variables/CmsVariableProviderTest.php b/typo3/sysext/fluid/Tests/Unit/Core/Variables/CmsVariableProviderTest.php index 5169a2d11e419c358aa237a1b067914a4d216dfd..1e453cfb448792bb2bfa8e2233ad5d61c5c58c1d 100644 --- a/typo3/sysext/fluid/Tests/Unit/Core/Variables/CmsVariableProviderTest.php +++ b/typo3/sysext/fluid/Tests/Unit/Core/Variables/CmsVariableProviderTest.php @@ -29,4 +29,21 @@ class CmsVariableProviderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTest $instance->setSource(['foo' => 'bar']); $this->assertEquals('bar', $instance->getByPath('foo')); } + + /** + * @test + */ + public function dynamicAccessWorks() + { + $instance = new CmsVariableProvider(); + $instance->setSource( + [ + 'foo' => [ + 'hello' => 'world', + ], + 'key' => 'hello' + ] + ); + $this->assertEquals('world', $instance->getByPath('foo.{key}')); + } }