Skip to content

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

Public Methods ​

MethodDescription
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

Arguments ​

Throws ​

getBuilderHtml() ​

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

View source

Returns ​

string

getBuilderInnerHtml() ​

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

View source

Arguments ​

  • $autofocusAddButton (boolean) – Whether the Add Rule button should be autofocused

Returns ​

string

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

Returns ​

string[], array[]

getConditionRules() ​

Returns the rules this condition is configured with.

View source

Returns ​

craft\base\conditions\ConditionRuleInterface[]

getConfig() ​

Returns the condition’s portable config.

View source

Returns ​

array

getSelectableConditionRules() ​

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

View source

Returns ​

craft\base\conditions\ConditionRuleInterface[]

setConditionRules() ​

Sets the rules this condition should be configured with.

View source

Arguments ​

Throws ​