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

Editing a field of a content type causes the display name to change directly to the technical name. #14985

Closed
chinasqzl opened this issue Jan 4, 2024 · 2 comments · Fixed by #15013
Labels
Milestone

Comments

@chinasqzl
Copy link

chinasqzl commented Jan 4, 2024

V1.8.0
image
image

@sebastienros sebastienros added this to the 1.x milestone Jan 4, 2024
@giannik
Copy link
Contributor

giannik commented Jan 6, 2024

can confirm this happens

@giannik
Copy link
Contributor

giannik commented Jan 6, 2024

seems it is caused from this pr :
#14571

@MikeAlhayek maybe a check should be done if displayname is null before explicitly setting the displayname to fieldname ?

also here :
https://github.com/OrchardCMS/OrchardCore/blob/8f0c371e95bea724534280f2ee81801699ab14d2/src/OrchardCore.Modules/OrchardCore.ContentTypes/Services/ContentDefinitionService.cs

maybe use the async version :partBuilder.WithFieldAsync

 public async Task AlterFieldAsync(EditPartViewModel partViewModel, EditFieldViewModel fieldViewModel)
        {
            await _contentDefinitionManager.AlterPartDefinitionAsync(partViewModel.Name, async   partBuilder =>
            {
              await Task.FromResult(partBuilder.WithFieldAsync(fieldViewModel.Name, fieldBuilder =>
               {
                   fieldBuilder.WithDisplayName(fieldViewModel.DisplayName);
                   fieldBuilder.WithEditor(fieldViewModel.Editor);
                   fieldBuilder.WithDisplayMode(fieldViewModel.DisplayMode);
                   return Task.CompletedTask;
               }));
            });
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment