Skip to content

Commit 9617358

Browse files
authored
BugFix: Classification Store Attribute Not Displaying Correct Value In Grid (#957)
* Check to see if attribute value is an array before accessing via value. * Remove unneeded empty check
1 parent cb6d097 commit 9617358

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/Service/GridData/DataObject.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,18 @@ public static function getData(AbstractObject $object, array $fields = null, str
180180
}
181181

182182
// because the key for the classification store has not a direct getter, you have to check separately if the data is inheritable
183-
if (str_starts_with($key, '~') && empty($data[$key]['value'])) {
184-
$type = $keyParts[1];
183+
if (str_starts_with($key, '~')) {
184+
$curClassAttributeValue = $data[$key] ?? null;
185+
$isValueEmpty = is_array($curClassAttributeValue) ? empty($curClassAttributeValue['value'] ?? null) : empty($curClassAttributeValue);
185186

186-
if ($type === 'classificationstore') {
187-
if (!empty($inheritedData = self::getInheritedData($object, $key, $requestedLanguage))) {
188-
$data[$dataKey] = $inheritedData['value'];
189-
$data['inheritedFields'][$dataKey] = ['inherited' => $inheritedData['parent']->getId() != $object->getId(), 'objectid' => $inheritedData['parent']->getId()];
187+
if ($isValueEmpty) {
188+
$type = $keyParts[1];
189+
190+
if ($type === 'classificationstore') {
191+
if (!empty($inheritedData = self::getInheritedData($object, $key, $requestedLanguage))) {
192+
$data[$dataKey] = $inheritedData['value'];
193+
$data['inheritedFields'][$dataKey] = ['inherited' => $inheritedData['parent']->getId() != $object->getId(), 'objectid' => $inheritedData['parent']->getId()];
194+
}
190195
}
191196
}
192197
}

0 commit comments

Comments
 (0)