Skip to content

Instantly share code, notes, and snippets.

@hallojoe
Created October 23, 2017 17:18
Show Gist options
  • Save hallojoe/932db1a0507c8ad7235f3510bdac85ad to your computer and use it in GitHub Desktop.
Save hallojoe/932db1a0507c8ad7235f3510bdac85ad to your computer and use it in GitHub Desktop.
Get alias of all fields that have an umbraco.tags property editor on top.
/// <summary>
/// Get the alias of all document type fields
/// where property editor alias is Umbraco.Tags
/// </summary>
/// <param name="applicationContext"></param>
/// <returns></returns>
internal List<string> GetAliasOfAllFieldsOfDataTypeTags(ApplicationContext applicationContext)
{
var result = new List<string>();
var documentTypes = applicationContext.Services.ContentTypeService.GetAllContentTypes();
foreach (var documentType in documentTypes)
foreach (var propertyType in documentType.PropertyTypes)
if (propertyType.PropertyEditorAlias.InvariantEquals("umbraco.tags"))
if (!result.Contains(propertyType.Alias))
result.Add(propertyType.Alias);
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment