private bool OfType(FilterContext context, IFilterTarget target, ContentFilterElement element)
{
FilterOperand[] operands = GetOperands(element, 1);
// get the desired type.
NodeId typeDefinitionId = GetValue(context, operands[0], target) as NodeId;
if (typeDefinitionId == null || target == null)
{
return false;
}
// check the type.
try
{
return target.IsTypeOf(context, typeDefinitionId);
}
catch
{
return false;
}
}