Class MacroField
- Namespace
- CMS.MacroEngine
- Assembly
- CMS.MacroEngine.dll
Wrapper for any macro data field (source).
public class MacroField : MacroExtension
- Inheritance
-
objectMacroField
- Inherited Members
- Extension Methods
Constructors
MacroField(string, Func<EvaluationContext, object>, Func<EvaluationContext, bool>)
Creates new instance with value evaluator which needs a context.
public MacroField(string name, Func<EvaluationContext, object> valueEvaluator, Func<EvaluationContext, bool> availabilityCondition = null)
Parameters
namestringName of the field
valueEvaluatorFunc<EvaluationContext, object>Value evaluation function which needs context
availabilityConditionFunc<EvaluationContext, bool>Availability condition
MacroField(string, Func<object>, Func<EvaluationContext, bool>)
Creates new instance with value evaluator which does not need a context.
public MacroField(string name, Func<object> valueEvaluator, Func<EvaluationContext, bool> availabilityCondition = null)
Parameters
namestringName of the field
valueEvaluatorFunc<object>Value evaluation function which does not need evaluation context
availabilityConditionFunc<EvaluationContext, bool>Availability condition
Methods
GetValue(EvaluationContext)
Returns the value of the field in the given evaluation context.
public object GetValue(EvaluationContext context)
Parameters
contextEvaluationContextEvaluation context under which to evaluate the field value
Returns
- object
IsFieldAvailable(EvaluationContext)
Returns true if the field is available in the given context.
public bool IsFieldAvailable(EvaluationContext context)
Parameters
contextEvaluationContextEvaluation context in which the field is being requested
Returns
- bool