toModel method
Implementation
@override
Model toModel() {
final Model entity = super.toModel();
return entity.copyWith(
fields: [
[
fieldToModelName,
fieldToModelId,
fieldToModelVirtualField,
],
[
fieldToModelModel,
],
[
StructuredField(
id: fieldTitleFieldsProperty,
name: 'Related model fields',
structure: [
EnumField(
id: fieldTypeProperty,
name: 'Type',
isRequired: true,
values: [
EnumValue(title: 'Field', value: TitleFieldType.externalField.name),
EnumValue(title: 'Divider', value: TitleFieldType.fieldsDivider.name),
EnumValue(title: 'Decorator', value: TitleFieldType.fieldsDecorator.name),
],
),
StringField(id: fieldValueProperty, name: 'Value', isRequired: true),
],
),
],
[
StructuredField(
id: fieldThirdTableProperty,
name: 'Third table',
singleObject: true,
structure: [
ModelsSelectorField(
id: 'relationsEntity',
name: 'Relations model',
isRequired: true,
),
StringField(id: 'parentEntityIdName', name: 'Parent Model ID', isRequired: true),
StringField(id: 'childEntityIdName', name: 'Child Model ID', isRequired: true),
],
),
],
[
fieldToModelSort,
fieldToModelShowInList,
fieldToModelIsRequired,
],
// TODO(alphamikle): Make code field
// [
// if (Env.isRealCMS) fieldToModelValidator,
// ],
],
);
}