mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
prevent adding existing tags
This commit is contained in:
@@ -128,7 +128,14 @@ namespace Orchard.Taxonomies.Drivers {
|
||||
}
|
||||
|
||||
private TermPart GetOrCreateTerm(TermEntry entry, int taxonomyId, TaxonomyField field) {
|
||||
var term = entry.Id > 0 ? _taxonomyService.GetTerm(entry.Id) : default(TermPart);
|
||||
var term = default(TermPart);
|
||||
|
||||
if (entry.Id > 0)
|
||||
term = _taxonomyService.GetTerm(entry.Id);
|
||||
|
||||
//Prevents creation of existing term
|
||||
if (term == null && !string.IsNullOrEmpty(entry.Name))
|
||||
term = _taxonomyService.GetTermByName(taxonomyId, entry.Name.Trim());
|
||||
|
||||
if (term == null) {
|
||||
var settings = field.PartFieldDefinition.Settings.GetModel<TaxonomyFieldSettings>();
|
||||
|
Reference in New Issue
Block a user