Class PropertyTagsExtensions
Provides extension methods for the Property class to manage tags.
Inheritance
Namespace: Umbraco.Extensions
Assembly: Umbraco.Core.dll
Syntax
public static class PropertyTagsExtensions
Methods
View SourceAssignTags(IProperty, PropertyEditorCollection, IDataTypeService, IJsonSerializer, IEnumerable<string>, bool, string?)
Assign tags.
Declaration
public static void AssignTags(this IProperty property, PropertyEditorCollection propertyEditors, IDataTypeService dataTypeService, IJsonSerializer serializer, IEnumerable<string> tags, bool merge = false, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IProperty | property | The property. |
| PropertyEditorCollection | propertyEditors | |
| IDataTypeService | dataTypeService | |
| IJsonSerializer | serializer | |
| IEnumerable<string> | tags | The tags. |
| bool | merge | A value indicating whether to merge the tags with existing tags instead of replacing them. |
| string | culture | A culture, for multi-lingual properties. |
GetTagConfiguration(IProperty, PropertyEditorCollection, IDataTypeService)
Declaration
public static TagConfiguration? GetTagConfiguration(this IProperty property, PropertyEditorCollection propertyEditors, IDataTypeService dataTypeService)
Parameters
| Type | Name | Description |
|---|---|---|
| IProperty | property | |
| PropertyEditorCollection | propertyEditors | |
| IDataTypeService | dataTypeService |
Returns
| Type | Description |
|---|---|
| TagConfiguration |
GetTagsValue(IProperty, PropertyEditorCollection, IDataTypeService, IJsonSerializer, string?)
Declaration
public static IEnumerable<string> GetTagsValue(this IProperty property, PropertyEditorCollection propertyEditors, IDataTypeService dataTypeService, IJsonSerializer serializer, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IProperty | property | |
| PropertyEditorCollection | propertyEditors | |
| IDataTypeService | dataTypeService | |
| IJsonSerializer | serializer | |
| string | culture |
Returns
| Type | Description |
|---|---|
| IEnumerable<string> |
RemoveTags(IProperty, PropertyEditorCollection, IDataTypeService, IJsonSerializer, IEnumerable<string>, string?)
Removes tags.
Declaration
public static void RemoveTags(this IProperty property, PropertyEditorCollection propertyEditors, IDataTypeService dataTypeService, IJsonSerializer serializer, IEnumerable<string> tags, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IProperty | property | The property. |
| PropertyEditorCollection | propertyEditors | |
| IDataTypeService | dataTypeService | |
| IJsonSerializer | serializer | |
| IEnumerable<string> | tags | The tags. |
| string | culture | A culture, for multi-lingual properties. |
SetTagsValue(IProperty, IJsonSerializer, object?, TagConfiguration?, string?)
Sets tags on a content property, based on the property editor tags configuration.
Declaration
public static void SetTagsValue(this IProperty property, IJsonSerializer serializer, object? value, TagConfiguration? tagConfiguration, string? culture)
Parameters
| Type | Name | Description |
|---|---|---|
| IProperty | property | The property. |
| IJsonSerializer | serializer | |
| object | value | The property value. |
| TagConfiguration | tagConfiguration | The datatype configuration. |
| string | culture | A culture, for multi-lingual properties. |
Remarks
The value is either a string (delimited string) or an enumeration of strings (tag list).
This is used both by the content repositories to initialize a property with some tag values, and by the content controllers to update a property with values received from the property editor.