ConditionInterface

Type
Interface
Namespace
craft\base\conditions
Implemented by
craft\base\conditions\BaseCondition, craft\elements\conditions\ElementCondition, craft\elements\conditions\ElementConditionInterface, craft\elements\conditions\addresses\AddressCondition, craft\elements\conditions\assets\AssetCondition, craft\elements\conditions\categories\CategoryCondition, craft\elements\conditions\entries\EntryCondition, craft\elements\conditions\tags\TagCondition, craft\elements\conditions\users\UserCondition
Since
4.0.0

ConditionInterface defines the common interface to be implemented by condition classes.

A base implementation is provided by craft\base\conditions\BaseCondition.

View source (opens new window)

# Public Methods

Method Description
addConditionRule() Adds a rule to the condition.
getBuilderHtml() Renders the HTML for the condition builder, including its outer container element.
getBuilderInnerHtml() Renders the inner HTML for the condition builder, excluding its outer container element.
getConditionRuleTypes() Returns the available rule types for this condition.
getConditionRules() Returns the rules this condition is configured with.
getConfig() Returns the condition’s portable config.
getSelectableConditionRules() Returns the selectable rules for the condition, indexed by type.
setConditionRules() Sets the rules this condition should be configured with.

# addConditionRule()

Adds a rule to the condition.

View source (opens new window)

Arguments

Throws

# getBuilderHtml()

Renders the HTML for the condition builder, including its outer container element.

View source (opens new window)

Returns

string (opens new window)

# getBuilderInnerHtml()

Renders the inner HTML for the condition builder, excluding its outer container element.

View source (opens new window)

Arguments

Returns

string (opens new window)

# getConditionRuleTypes()

Returns the available rule types for this condition.

Rule types should be defined as either the class name or an array with a class key set to the class name.

View source (opens new window)

Returns

string (opens new window)[], array (opens new window)[]

# getConditionRules()

Returns the rules this condition is configured with.

View source (opens new window)

Returns

craft\base\conditions\ConditionRuleInterface[]

# getConfig()

Returns the condition’s portable config.

View source (opens new window)

Returns

array (opens new window)

# getSelectableConditionRules()

Returns the selectable rules for the condition, indexed by type.

View source (opens new window)

Returns

craft\base\conditions\ConditionRuleInterface[]

# setConditionRules()

Sets the rules this condition should be configured with.

View source (opens new window)

Arguments

Throws