diff --git a/src/Contao/View/Contao2BackendView/ButtonRenderer.php b/src/Contao/View/Contao2BackendView/ButtonRenderer.php index 7c6fe0ea..5b74d44b 100644 --- a/src/Contao/View/Contao2BackendView/ButtonRenderer.php +++ b/src/Contao/View/Contao2BackendView/ButtonRenderer.php @@ -64,6 +64,7 @@ use function is_string; use function ltrim; use function sprintf; +use function str_replace; use function strlen; use function strrpos; use function substr_replace; @@ -345,6 +346,9 @@ private function buildCommand($command, $model, $previous, $next, $isCircularRef } } + $definitionName = $this->environment->getDataDefinition()?->getName(); + assert(is_string($definitionName)); + $buttonEvent = new GetOperationButtonEvent($this->environment); $buttonEvent ->setKey($command->getName()) @@ -352,7 +356,13 @@ private function buildCommand($command, $model, $previous, $next, $isCircularRef ->setObjModel($model) ->setAttributes($attributes) ->setLabel($this->getCommandLabel($command)) - ->setTitle(sprintf($this->translate($command->getDescription()), $model->getID())) + ->setTitle( + $this->translateButtonDescription( + str_replace('.description', '', $command->getDescription()), + $definitionName, + ['%id%' => $model->getId()] + ) + ) ->setHref($this->calculateHref($command, $model)) ->setChildRecordIds($childIds) ->setCircularReference($isCircularReference)