Skip to content

Commit

Permalink
bug #5334 Fix a regression in the textarea fields shown on index page…
Browse files Browse the repository at this point in the history
… (javiereguiluz)

This PR was merged into the 4.x branch.

Discussion
----------

Fix a regression in the textarea fields shown on index page

Fixes #5179.

Commits
-------

417e264 Fix a regression in the textarea fields shown on index page
  • Loading branch information
javiereguiluz committed Jul 14, 2022
2 parents e46f66c + 417e264 commit 03b868a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Field/Configurator/TextConfigurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function configure(FieldDto $field, EntityDto $entityDto, AdminContext $c
$configuredMaxLength = $field->getCustomOption(TextField::OPTION_MAX_LENGTH);
// when contents are rendered as HTML, "max length" option is ignored to prevent
// truncating contents in the middle of an HTML tag, which messes the entire backend
if (!$renderAsHtml && null !== $configuredMaxLength) {
if (!$renderAsHtml) {
$isDetailAction = Action::DETAIL === $context->getCrud()->getCurrentAction();
$defaultMaxLength = $isDetailAction ? \PHP_INT_MAX : 64;
$formattedValue = u($formattedValue)->truncate($configuredMaxLength ?? $defaultMaxLength, '…')->toString();
Expand Down

0 comments on commit 03b868a

Please sign in to comment.