Skip to content

Commit

Permalink
avoid too many hacks
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Jan 12, 2025
1 parent 457d5d2 commit 89e552c
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/Form/Layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,7 @@ private function getEntityFieldCaptionWithoutIdSuffix(Control $control): string
{
$field = $control->entityField->getField();

$idSuffixes = ['ID'];
if ($field->getOwner()->idField && $field->getOwner()->hasField($field->getOwner()->idField)) {
$idSuffixes = $field->getOwner()->getIdField()->getCaption();
}

return preg_replace('~ (' . implode('|', array_map(fn ($v) => preg_quote($v, '~'), $idSuffixes)) . ')$~i', '', $field->getCaption());
return preg_replace('~ ID$~i', '', $field->getCaption());
}

#[\Override]
Expand Down

0 comments on commit 89e552c

Please sign in to comment.