Table of Contents

Class MacroField

Namespace
CMS.MacroEngine
Assembly
CMS.MacroEngine.dll

Wrapper for any macro data field (source).

public class MacroField : MacroExtension
Inheritance
object
MacroField
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

name string

Name of the field

valueEvaluator Func<EvaluationContext, object>

Value evaluation function which needs context

availabilityCondition Func<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

name string

Name of the field

valueEvaluator Func<object>

Value evaluation function which does not need evaluation context

availabilityCondition Func<EvaluationContext, bool>

Availability condition

Methods

GetValue(EvaluationContext)

Returns the value of the field in the given evaluation context.

public object GetValue(EvaluationContext context)

Parameters

context EvaluationContext

Evaluation 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

context EvaluationContext

Evaluation context in which the field is being requested

Returns

bool