toModel method

  1. @override
Model toModel()
override

Implementation

@override
Model toModel() {
  final Model entity = super.toModel();
  return entity.copyWith(
    fields: [
      [
        fieldToModelName,
        fieldToModelId,
        fieldToModelVirtualField,
      ],
      [
        fieldToModelSort,
        fieldToModelShowInList,
        fieldToModelIsRequired,
      ],
      [
        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),
          ],
        ),
      ],
    ],
  );
}