Skip to content

Commit 90ac3fe

Browse files
committed
Fix issue #1073
Table headings are now also populated even if the attribute is not contained within the input screen but only in the render settings (column layout only)
1 parent 7a20074 commit 90ac3fe

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

src/MetaModels/ContaoIntegration/Boot.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,13 @@ function (PreCreateDcGeneralEvent $event) use ($metaModelName, $viewCombinations
123123
return;
124124
}
125125

126-
$inputScreen = $viewCombinations->getInputScreenDetails($metaModelName);
126+
$inputScreen = $viewCombinations->getInputScreenDetails($metaModelName);
127+
$renderSetting = $viewCombinations->getRenderSetting($metaModelName);
127128

128129
$factory->setContainerClassName('MetaModels\DcGeneral\DataDefinition\MetaModelDataDefinition');
129130

130131
$dispatcher = $container->getEventDispatcher();
131-
$generator = new Builder($container, $inputScreen);
132+
$generator = new Builder($container, $inputScreen, $renderSetting);
132133

133134
$dispatcher->addListener(
134135
BuildDataDefinitionEvent::NAME,

src/MetaModels/DcGeneral/Dca/Builder/Builder.php

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,15 @@ class Builder
128128
* @param IMetaModelsServiceContainer $serviceContainer The name of the MetaModel being created.
129129
*
130130
* @param IInputScreen $inputScreen The input screen to use.
131+
*
132+
* @param int $renderSetting The render setting.
131133
*/
132-
public function __construct($serviceContainer, $inputScreen)
134+
public function __construct($serviceContainer, $inputScreen, $renderSetting)
133135
{
134136
$this->serviceContainer = $serviceContainer;
135137
$this->inputScreen = $inputScreen;
136138
$this->translator = new StaticTranslator();
139+
$this->renderSetting = $renderSetting;
137140
}
138141

139142
/**
@@ -1113,11 +1116,14 @@ protected function parseListLabel(IMetaModelDataDefinition $container, ListingCo
11131116
} else {
11141117
$formatter = $listing->getLabelFormatter($providerName);
11151118
}
1116-
1119+
$renderSetting = $this->serviceContainer->getRenderSettingFactory()->createCollection(
1120+
$this->getMetaModel(),
1121+
$this->renderSetting
1122+
);
11171123
$formatter->setPropertyNames(
11181124
array_merge(
11191125
$formatter->getPropertyNames(),
1120-
$container->getPropertiesDefinition()->getPropertyNames()
1126+
$renderSetting->getSettingNames()
11211127
)
11221128
);
11231129

@@ -1349,7 +1355,7 @@ protected function buildPropertyFromDca(
13491355
$metaModel = $this->getMetaModel();
13501356
$attribute = $metaModel->getAttribute($propName);
13511357

1352-
if (!$attribute || !$propInfo) {
1358+
if (!$attribute) {
13531359
return;
13541360
}
13551361

@@ -1362,16 +1368,20 @@ protected function buildPropertyFromDca(
13621368
$definition->addProperty($property);
13631369
}
13641370

1365-
if (!$property->getLabel() && isset($propInfo['label'])) {
1366-
$lang = $propInfo['label'];
1371+
if (!$property->getLabel()) {
1372+
if (isset($propInfo['label'])) {
1373+
$lang = $propInfo['label'];
13671374

1368-
if (is_array($lang)) {
1369-
$label = reset($lang);
1370-
$description = next($lang);
1375+
if (is_array($lang)) {
1376+
$label = reset($lang);
1377+
$description = next($lang);
13711378

1372-
$property->setDescription($description);
1379+
$property->setDescription($description);
1380+
} else {
1381+
$label = $lang;
1382+
}
13731383
} else {
1374-
$label = $lang;
1384+
$label = $attribute->getName();
13751385
}
13761386

13771387
$property->setLabel($label);

0 commit comments

Comments
 (0)