From 8b77c0203bdc31d67e54f0b0e2fe439058a44f03 Mon Sep 17 00:00:00 2001 From: Ingolf Steinardt Date: Mon, 13 May 2024 16:17:37 +0200 Subject: [PATCH] Changes for MM xliff --- .../Contao2BackendView/ActionHandler/ShowHandler.php | 2 +- src/Contao/View/Contao2BackendView/ButtonRenderer.php | 8 +++++++- .../View/Contao2BackendView/GlobalButtonRenderer.php | 9 ++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Contao/View/Contao2BackendView/ActionHandler/ShowHandler.php b/src/Contao/View/Contao2BackendView/ActionHandler/ShowHandler.php index f24d3d94..2349ae48 100644 --- a/src/Contao/View/Contao2BackendView/ActionHandler/ShowHandler.php +++ b/src/Contao/View/Contao2BackendView/ActionHandler/ShowHandler.php @@ -196,7 +196,7 @@ protected function getPropertyLabel(EnvironmentInterface $environment, PropertyI $key = $property->getLabel(); - if ('' === $key || null === $key) { + if ('' === $key) { throw new LogicException('Missing label for property ' . $property->getName()); } diff --git a/src/Contao/View/Contao2BackendView/ButtonRenderer.php b/src/Contao/View/Contao2BackendView/ButtonRenderer.php index 7fe862b5..00d5484f 100644 --- a/src/Contao/View/Contao2BackendView/ButtonRenderer.php +++ b/src/Contao/View/Contao2BackendView/ButtonRenderer.php @@ -661,7 +661,13 @@ protected function translateButtonDescription( if ( 1 !== preg_match('#%(?:[bcdeEfFgGhHosuxX]|\d*\$[bcdeEfFgGhHosuxX])#', $buttonName) && $definitionName . '.' . $buttonName . '.1' - !== ($header = $this->translator->translate($definitionName . '.' . $buttonName . '.1', 'contao_' . $definitionName, $parameter)) + !== ( + $header = $this->translator->translate( + $definitionName . '.' . $buttonName . '.1', + 'contao_' . $definitionName, + $parameter + ) + ) ) { return $header; } diff --git a/src/Contao/View/Contao2BackendView/GlobalButtonRenderer.php b/src/Contao/View/Contao2BackendView/GlobalButtonRenderer.php index 78f78992..c8d4efac 100644 --- a/src/Contao/View/Contao2BackendView/GlobalButtonRenderer.php +++ b/src/Contao/View/Contao2BackendView/GlobalButtonRenderer.php @@ -115,6 +115,9 @@ public function render() * @param CommandInterface $command The command definition. * * @return string + * + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @SuppressWarnings(PHPMD.NPathComplexity) */ private function renderButton(CommandInterface $command) { @@ -197,8 +200,12 @@ private function translate(string $path): string if ($path !== ($value = $this->translator->translate($path, $domain))) { return $value; } + // Fallback translate for non symfony domain. - if ($domain . '.' . $path !== ($value = $this->translator->translate($domain . '.' . $path, 'contao_' . $domain))) { + if ( + $domain . '.' . $path !== ($value = + $this->translator->translate($domain . '.' . $path, 'contao_' . $domain)) + ) { return $value; }