Class EntityTypeFilter
Keep only entities of a specific content-type
Data Source: ContentType EntityType Filter
Note
this data source used to be called EntityTypeFilter, we renamed it in 2sxc 9.8 for consistency
The ContentTypeFilter DataSource is part of the Standard EAV Data Sources. It will only let items pass through, which are of a specific type.
How to use with the VisualQuery
When using the VisualQuery you can just drag it into your query. In the settings you'll specify the type-name. The resulting query will usually be a bit like this:
The above example shows:
- a two content-type filters, each filtering a different type
Programming With The ContentTypeFilter DataSource
We recommend to use the VisualQuery where possible, as it's easier to understand and is identical for C# and JavaScript. It's also better because it separates data-retrieval from visualization.
// A source which can filter by Content-Type (EntityType)
var allAuthors = CreateSource<EntityTypeFilter>();
allAuthors.TypeName = "Author";
Read also
Demo App and further links
You should find some examples in this demo App
History
- Introduced in EAV 3.x, 2sxc ?
API Documentation
Inheritance
Implements
Inherited Members
Namespace: ToSic.Eav.DataSources
Assembly: ToSic.Eav.DataSources.dll
Syntax
[PublicApi_Stable_ForUseInYourCode]
[VisualQuery(NiceName = "Type-Filter", UiHint = "Only keep items of the specified type", Icon = "alt_route", Type = DataSourceType.Filter, NameId = "ToSic.Eav.DataSources.EntityTypeFilter, ToSic.Eav.DataSources", DynamicOut = false, In = new string[]{"Default*"}, ConfigurationType = "|Config ToSic.Eav.DataSources.EntityTypeFilter", HelpLink = "https://r.2sxc.org/DsTypeFilter")]
public class EntityTypeFilter : DataSourceBase, IDataSource, IAppIdentity, IZoneIdentity, IAppIdentityLight, ICacheInfo, ICacheKey, ICacheExpiring, ITimestamped, ICanPurgeListCache, IHasLog, IDataTarget, IAppIdentitySync, IDataSourceLinkable
Remarks
Had a major, breaking update in v15. Consult the guide to upgrade your custom data sources.
Properties
| Improve this Doc View SourceTypeName
The name of the type to filter for. Either the normal name or the 'StaticName' which is usually a GUID.
Declaration
[Configuration]
public string TypeName { get; set; }
Property Value
Type | Description |
---|---|
System.String |