Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Calculated value] Context for localized calculated field in object brick #5337

Open
BlackbitNeueMedien opened this issue Nov 26, 2019 · 1 comment

Comments

@BlackbitNeueMedien
Copy link
Contributor

@BlackbitNeueMedien BlackbitNeueMedien commented Nov 26, 2019

When you have a localized calculated field in an object brick there is a conflict with the context. As https://pimcore.com/docs/6.x/Development_Documentation/Objects/Object_Classes/Data_Types/Calculated_Value_Type.html states about context:

  • Localized fields:
    • position | the language ("en", "de", ...)
    • ownerType | "localizedfield"
    • ownerName | the name of the localized field ("localizedfields")
  • Objectbricks
    • ownerType | "objectbrick"
    • ownerName | the name of the objectbrick field inside the object
    • fieldName | the name of the attribute inside the brick
    • index | the name of the brick
    • keyDefinition | the calculated-value field definition

For object bricks also field position gets set but to the same value as fieldName:

$fieldData = new DataObject\Data\CalculatedValue($fd->getName());
$fieldData->setContextualData('objectbrick', $this->getName(), $allowedBrickType, $fd->getName(), null, null, $fd);

When you want to determine the language for the value generation of the calculated field, we need to set position to the language here. This currently does not work because the object brick fetches all descendant calculated value fields, not only children - bypassing the localized value field which would add the language as field position:

self::collectCalculatedValueItems($collectionDef->getFieldDefinitions(), $calculatedChilds);

@weisswurstkanone

This comment has been minimized.

Copy link
Contributor

@weisswurstkanone weisswurstkanone commented Nov 29, 2019

what would be your proposed solution? mayne we can add an additional value?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.