flag exclude children for taxonomies (#8481)

This commit is contained in:
ElenaRepository 2021-06-21 09:42:59 +02:00 committed by GitHub
parent 230dfc30da
commit f23d9292c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View File

@ -47,7 +47,10 @@ namespace Orchard.Taxonomies.Projections {
var terms = ids.Select(_taxonomyService.GetTerm).ToList();
var allChildren = new List<TermPart>();
foreach (var term in terms) {
bool.TryParse(context.State.ExcludeChildren?.Value, out bool excludeChildren);
if (!excludeChildren)
allChildren.AddRange(_taxonomyService.GetChildren(term));
if (term != null)
allChildren.Add(term);
}

View File

@ -48,6 +48,11 @@ namespace Orchard.Taxonomies.Projections {
Id: "operator-is-all-of", Name: "Operator",
Title: T("Is all of"), Value: "1"
)
),
_ExcludeChildren: Shape.Checkbox(
Id: "ExcludeChildren", Name: "ExcludeChildren",
Title: T("Automatically exclude children terms in filtering"),
Value: "true"
)
);