Skip to content

[Studio] Register CoreShop field types in the class definition editor - #3261

Merged
dpfaffenbauer merged 4 commits into
coreshop:5.1from
dpfaffenbauer:issue/3260
Sep 22, 2026
Merged

dpfaffenbauer merged 4 commits into
coreshop:5.1from
dpfaffenbauer:issue/3260

Conversation

@dpfaffenbauer

Copy link
Copy Markdown
Member

Closes #3260

Root cause

Studio keeps two registries per DataObject field type. CoreShop registered all its CoreExtension types only in DynamicTypes/ObjectDataRegistry (object editor) and never in DynamicTypes/FieldDefinitionRegistry (class definition editor), so LayoutForm fell through to "Type not supported" and the "add field" dropdown, which is built from the same registry via tags, had no CoreShop entries.

Class editor types

Every one of the 31 field types (the 29 from the issue plus coreShopRelation / coreShopRelations) gets a DynamicTypeFieldDefinitionCoreShop<Name> next to its object data type and is registered in each bundle's main.ts (IndexBundle: modules/filters/module.ts) via registerCoreShopFieldDefinitionTypes([...]), inside the same try/catch that already guards the object data registry for the document editor iframe. The types appear under a new "CoreShop" group in the dropdown (registerDropdownGroupInfo, registered idempotently via getDropdownGroupInfos() because every bundle calls it).

Base classes and bundle boundaries

  • PimcoreBundle/.../dynamic-types/field-definitions/: DynamicTypeFieldDefinitionCoreShopAbstract (group, default icon, hides "unique"), group registration, registerCoreShopFieldDefinitionTypes(), shared WidthFormItem / HeightFormItem / MinMaxFormItems. Lives here because MoneyBundle, PimcoreBundle and ProductQuantityPriceRulesBundle do not depend on ResourceBundle. Money and ProductQuantityPriceRules get @coreshop/pimcore as npm dependency.
  • ResourceBundle/.../dynamic-types/field-definitions/: ...CoreShopSelect (width, allowEmpty), ...CoreShopMultiselect (width, height, maxItems, renderType), ...CoreShopRelation / ...CoreShopRelations extending Pimcore's DynamicTypeFieldDefinitionManyToOne / ManyToMany with the resource stack select (options from the existing resource config endpoint) and returnConcrete.
  • Plain resource selects (store, currency, country, state, carrier, payment provider, tax rate/rule group, cart price rule, filter, product unit, address identifier and the multiselect variants) are one-liners on those bases. Own forms for coreShopMoney (defaultValue, min/max, nullable), coreShopMoneyCurrency and coreShopStoreValues (width, min/max), coreShopProductUnitDefinitions (width), the two price rule types (height), coreShopSerializedData (no settings panel) and the four DynamicDropdown variants (folderName, className from the class definition API, methodName, sortBy, recursive, onlyPublished).

Form field names match the public properties of the PHP CoreExtension classes, since the class editor saves the raw field definition.

Translations and docs

field-definition.<kebab-case id> plus the .with-prefix.add / .with-prefix.convert variants Pimcore uses when a type is promoted to the dropdown root, en and de, in every bundle. New labels use coreshop_field_definition_*. New docs page docs/03_Development/14_Studio/02_Base_Infrastructure/06_Dynamic_Types.md (registries, base classes, registration, translations, type overview), linked from the Studio index; changelog entry under 5.1.3; CLAUDE.md section.

Test

  • tsc --noEmit per affected bundle (14 bundles) against @pimcore/studio-ui-bundle 2025.4.13: 0 errors.
  • npm run build (rsbuild / module federation): all bundles built. Build archives are not part of this PR, the frontend build workflow commits them.
  • Not tested in a running Studio; please check that the "CoreShop" group shows all types and that saving an existing class keeps the type-specific values (allowEmpty, stack, ...).

Not in this PR

The same change for 2026.x follows via the automated upmerge (the branch applies cleanly there; the 2026.x tree only differs in the two package.json files).

Studio keeps two frontend registries per DataObject field type: the
ObjectDataRegistry renders the value in the object editor, the
FieldDefinitionRegistry drives the class definition editor and its
"add field" dropdown. CoreShop only registered its 31 CoreExtension
types in the first one, so the class editor showed "Type not supported"
and the types could not be added through Studio at all.

Every type now has a DynamicTypeFieldDefinitionCoreShop* counterpart
next to its object data type, grouped under a new "CoreShop" entry in
the dropdown. The abstract base, the group registration and the shared
width/height/min-max form items live in PimcoreBundle because
MoneyBundle, PimcoreBundle and ProductQuantityPriceRulesBundle do not
depend on ResourceBundle; ResourceBundle adds the select, multiselect
and relation bases on top. Form field names match the public
properties of the PHP CoreExtension classes, since the class editor
saves the raw field definition.

Translations (en/de) follow Pimcore's field-definition.<kebab-case id>
scheme including the with-prefix variants. Documentation in
docs/03_Development/14_Studio/02_Base_Infrastructure/06_Dynamic_Types.md.

Closes coreshop#3260
The group icon was copied from ResourceBundle's legacy logo.svg; the
Studio icon library uses logo-fill.svg from CoreBundle as the CoreShop
logo everywhere else.

Refs coreshop#3260
coreShopMoneyCurrency extends the abstract field definition base from
PimcoreBundle; composer already depends on it transitively via
resource-bundle, the npm workspace dependency was missing.

Refs coreshop#3260
@sonarqubecloud

Copy link
Copy Markdown

@dpfaffenbauer
dpfaffenbauer merged commit 9340636 into coreshop:5.1 Sep 22, 2026
31 checks passed
@dpfaffenbauer
dpfaffenbauer deleted the issue/3260 branch September 22, 2026 15:09
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 22, 2026
@dpfaffenbauer dpfaffenbauer added this to the 5.1.3 milestone Sep 22, 2026
@dpfaffenbauer dpfaffenbauer self-assigned this Sep 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant