Skip to content

Commit

Permalink
Fix classification store localized attr. error
Browse files Browse the repository at this point in the history
For localized classification store attributes, the classificationKeyId is empty. The identification of the related attribute takes place based on the attribute name, which is fine.
However, for Pimcore X, the KeyConfig::getById() will cause an exception causing an error in the user interface, because the classificationKeyId is empty in that case.
To avoid the exception, an additional condition has been added.
  • Loading branch information
andreas-gruenwald authored and dvesh3 committed Dec 22, 2021
1 parent ac08a0d commit 92a1fd1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Controller/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,10 @@ private function getFieldDefinition($attributeName, $objectClass)
$classificationKeyId = $classificationKeyParts[0];
$classificationKeyName = $classificationKeyParts[1];

if ($keyConfig = KeyConfig::getById($classificationKeyId)) {
$def = \Pimcore\Model\DataObject\Classificationstore\Service::getFieldDefinitionFromKeyConfig($keyConfig);
if (!empty($classificationKeyId)) { // for localized classification store attributes, such as #cs##Ba the key will be empty.
if ($keyConfig = KeyConfig::getById($classificationKeyId)) {
$def = \Pimcore\Model\DataObject\Classificationstore\Service::getFieldDefinitionFromKeyConfig($keyConfig);
}
}
} elseif ($brickKey && strpos($brickType, '?') === 0) {
$definitionJson = substr($brickType, 1);
Expand Down

0 comments on commit 92a1fd1

Please sign in to comment.