"savedEntity.CultureInfos.Values" is null if a Document Type has "Allow vary by culture" set to false
Hi,
I have just updated Umbraco to the v. 9.0.1 and I'm facing a different behavior when I'm trying to check CultureInfos property in a "Component" that extend INotificationHandler<ContentSavingNotification>.
When I try to get the values from "CultureInfos", if the saved Document Type has the Allow vary by culture set to false (turned off), I get a null value.
Before the update to the v.9 stable, with the Umbraco v. 9.0.0-beta002 the "CultureInfos" worked fine, returning at least one element, that is the default language.
Do you have any suggestions? Is that a bug?
Here the code snippet:
public class WhenAPageIsPublishedComponent : INotificationHandler<ContentSavingNotification>
{
private readonly IConfiguration configuration;
public WhenAPageIsPublishedComponent(IHttpContextAccessor contextAccessor, IConfiguration configuration)
{
...
}
public void Handle(ContentSavingNotification notification)
{
foreach (IContent savedEntity in notification.SavedEntities)
{
string name = savedEntity.CultureInfos.Values.FirstOrDefault().Name;
...
}
}
"savedEntity.CultureInfos.Values" is null if a Document Type has "Allow vary by culture" set to false
Hi,
I have just updated Umbraco to the v. 9.0.1 and I'm facing a different behavior when I'm trying to check
CultureInfos
property in a "Component" that extendINotificationHandler<ContentSavingNotification>
.When I try to get the values from "CultureInfos", if the saved Document Type has the
Allow vary by culture
set tofalse
(turned off), I get anull
value.Before the update to the v.9 stable, with the Umbraco v. 9.0.0-beta002 the "CultureInfos" worked fine, returning at least one element, that is the default language.
Do you have any suggestions? Is that a bug?
Here the code snippet:
Thank you
I opened this issue on GitHub: https://github.com/umbraco/Umbraco-CMS/issues/11348
is working on a reply...