mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-01-22 21:02:08 +08:00
Added null checks (#8511)
The added null checks manage properly importing definitions that do not contain the properties.
This commit is contained in:
committed by
GitHub
parent
d51418b2c1
commit
e771a56c42
@@ -137,16 +137,21 @@ namespace Orchard.Projections.Settings {
|
|||||||
var settings = part.Settings.GetModel<ProjectionPartSettings>();
|
var settings = part.Settings.GetModel<ProjectionPartSettings>();
|
||||||
|
|
||||||
// from identity part of the query and guid of the layout find reference
|
// from identity part of the query and guid of the layout find reference
|
||||||
settings.QueryLayoutRecordId = GetQueryLayoutRecord(settings.IdentityQueryLayoutRecord);
|
settings.QueryLayoutRecordId = string.IsNullOrWhiteSpace(settings.IdentityQueryLayoutRecord)
|
||||||
|
? "-1" : GetQueryLayoutRecord(settings.IdentityQueryLayoutRecord);
|
||||||
|
|
||||||
List<string> identityForFilterQuery = new List<string>();
|
if (!string.IsNullOrWhiteSpace(settings.IdentityFilterQueryRecord)) {
|
||||||
foreach (var record in settings.IdentityFilterQueryRecord.Split('&').ToList()) {
|
List<string> identityForFilterQuery = new List<string>();
|
||||||
var correctId = GetQueryLayoutRecord(record);
|
foreach (var record in settings.IdentityFilterQueryRecord.Split('&').ToList()) {
|
||||||
if (!string.IsNullOrEmpty(correctId)) {
|
var correctId = GetQueryLayoutRecord(record);
|
||||||
identityForFilterQuery.Add(correctId);
|
if (!string.IsNullOrEmpty(correctId)) {
|
||||||
|
identityForFilterQuery.Add(correctId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
settings.FilterQueryRecordId = string.Join("&", identityForFilterQuery);
|
||||||
|
} else {
|
||||||
|
settings.FilterQueryRecordId = string.Empty;
|
||||||
}
|
}
|
||||||
settings.FilterQueryRecordId = string.Join("&", identityForFilterQuery);
|
|
||||||
|
|
||||||
_contentDefinitionManager.AlterTypeDefinition(context.ContentTypeDefinition.Name, cfg => cfg
|
_contentDefinitionManager.AlterTypeDefinition(context.ContentTypeDefinition.Name, cfg => cfg
|
||||||
.WithPart(part.PartDefinition.Name,
|
.WithPart(part.PartDefinition.Name,
|
||||||
@@ -261,4 +266,4 @@ namespace Orchard.Projections.Settings {
|
|||||||
return String.IsNullOrWhiteSpace(l.Description) ? descriptor.Display(new LayoutContext { State = FormParametersHelper.ToDynamic(l.State) }).Text : l.Description;
|
return String.IsNullOrWhiteSpace(l.Description) ? descriptor.Display(new LayoutContext { State = FormParametersHelper.ToDynamic(l.State) }).Text : l.Description;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user