Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/Service/GridData/DataObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use Pimcore\Model\DataObject\Service;
use Pimcore\Tool\Admin as AdminTool;
use Pimcore\Tool\Session;
use Pimcore\Model\DataObject\ClassDefinition\Data;
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface;

/**
Expand Down Expand Up @@ -180,7 +181,7 @@ public static function getData(AbstractObject $object, array $fields = null, str
}

// because the key for the classification store has not a direct getter, you have to check separately if the data is inheritable
if (str_starts_with($key, '~') && empty($data[$key]['value'])) {
if (str_starts_with($key, '~') && self::getClassificationStoreFieldDefinition($key)->isEmpty(is_array($data[$key]) ? $data[$key]['value'] : $data[$key])) {
$type = $keyParts[1];

if ($type === 'classificationstore') {
Expand Down Expand Up @@ -349,7 +350,7 @@ protected static function getInheritedData(Concrete $object, string $key, string
}

$inheritedValue = self::getStoreValueForObject($parent, $key, $requestedLanguage);
if (!empty($inheritedValue['value'])) {
if (!self::getClassificationStoreFieldDefinition($key)->isEmpty(is_array($inheritedValue) ? $inheritedValue['value'] : $inheritedValue)) {
return [
'parent' => $parent,
'value' => $inheritedValue,
Expand All @@ -358,4 +359,17 @@ protected static function getInheritedData(Concrete $object, string $key, string

return self::getInheritedData($parent, $key, $requestedLanguage);
}

protected static function getClassificationStoreFieldDefinition(string $key): Data
{
$keyParts = explode('~', $key);
$groupKeyId = explode('-', $keyParts[3]);

$keyid = (int) $groupKeyId[1];

$keyConfig = Model\DataObject\Classificationstore\KeyConfig::getById($keyid);
$type = $keyConfig->getType();
$definition = json_decode($keyConfig->getDefinition(), true);
return \Pimcore\Model\DataObject\Classificationstore\Service::getFieldDefinitionFromJson($definition, $type);
}
}