How to Add a Custom Object Datatype
Overview
This example adds a custom simpleText data object field type to
Pimcore Studio. Custom datatypes appear in the class definition
editor's field type dropdown and render as editable fields in the
data object editor and grid.
Files Overview
| Layer | File | Purpose |
|---|---|---|
| Core | SimpleText.php | Field definition class |
| Core | config.yaml | Field type registration |
| GDI | generic-data-index.yaml | Search index adapter |
| Studio Backend | studio_backend.yaml | Data adapter mapping |
| Studio Backend | SimpleTextDefinition.php | Grid column definition |
| Studio Backend | PimcoreStudioExampleExtension.php | Config loading |
| Studio Backend | services.yaml | Service registrations |
| Studio UI | dynamic-type-object-data-simple-text.tsx | Object editor + grid |
| Studio UI | dynamic-type-field-definition-simple-text.tsx | Class editor |
| Studio UI | simple-text-datatype-module.tsx | Registry registration |
| Studio UI | index.ts | Plugin entry point |
| Studio UI | plugins.ts | Plugin export |
Details
Adding a custom object datatype requires registration across four layers:
Pimcore Core:
- A field definition class extending
Pimcore\Model\DataObject\ClassDefinition\Data - Registration via
pimcore.objects.class_definitions.data.map
Generic Data Index:
- A field definition adapter tagged with
pimcore.generic_data_index.data-object.search_index_field_definitionfor search index support (reusesTextKeywordAdapterfor text fields)
Studio Backend:
- A data adapter mapping via
pimcore_studio_backend.data_object_data_adapter_mappingfor save/load (reusesStringAdapterfor text fields) - A
ColumnDefinitionInterfacetagged withpimcore.studio_backend.grid_column_definitionfor data object grid column and filter support
Studio UI (Frontend):
- A
DynamicTypeObjectDataAbstractInputsubclass for the data object editor and grid, withdynamicTypeFieldFilterTypeset for grid filter support - A
DynamicTypeFieldDefinitionDataAbstractsubclass for the class definition editor - Registration of both types via a module and plugin
The example implements simpleText as a simple text input,
demonstrating the full pattern without additional complexity.
For the step-by-step guide, see Adding Object Datatypes in the Pimcore core documentation.