Skip to content

Commit

Permalink
keep things simple until non-ID reference in Lookup is supported
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Jan 12, 2025
1 parent 89e552c commit d724320
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/Form/Layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,6 @@ public function addSubLayout($seed = [self::class], $addDivider = true)
return $v;
}

private function getEntityFieldCaptionWithoutIdSuffix(Control $control): string
{
$field = $control->entityField->getField();

return preg_replace('~ ID$~i', '', $field->getCaption());
}

#[\Override]
protected function recursiveRender(): void
{
Expand Down Expand Up @@ -178,9 +171,10 @@ protected function recursiveRender(): void
$template = $element->renderLabel ? $labeledControl : $noLabelControl;
$label = $element->caption;
if ($label === null) {
$label = property_exists($element, 'model')
? $this->getEntityFieldCaptionWithoutIdSuffix($element)
: $element->entityField->getField()->getCaption();
$label = $element->entityField->getField()->getCaption();
if (property_exists($element, 'model')) {
$label = preg_replace('~ ID$~i', '', $label);
}
}

// anything but form controls gets inserted directly
Expand Down

0 comments on commit d724320

Please sign in to comment.