Skip to content

ElementConditionInterface ​

Type
Interface
Namespace
craft\elements\conditions
Extends
craft\base\conditions\ConditionInterface
Implemented by
craft\elements\conditions\ElementCondition, 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

ElementConditionInterface defines the common interface to be implemented by element conditions.

A base implementation is provided by craft\elements\conditions\ElementCondition.

View source

Public Methods ​

MethodDescription
addConditionRule()Adds a rule to the condition.
createConditionRule()Creates a condition rule instance.
getBuilderConfig()Returns configuration that should be maintained for the builder.
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.
getConditionRules()Returns the rules this condition is configured with.
getConfig()Returns the condition’s portable config.
getFieldLayouts()Returns the possible field layouts that the condition could be working with.
getSelectableConditionRules()Returns the selectable rules for the condition, indexed by type.
matchElement()Returns whether the given element matches the condition.
modifyQuery()Modifies a given query based on the configured condition rules.
setConditionRules()Sets the rules this condition should be configured with.
setFieldLayouts()Sets the possible field layouts that the condition could be working with.

getFieldLayouts() ​

Since
5.0.0

Returns the possible field layouts that the condition could be working with.

View source

Returns ​

craft\models\FieldLayout[]

matchElement() ​

Returns whether the given element matches the condition.

View source

Arguments ​

Returns ​

boolean

modifyQuery() ​

Modifies a given query based on the configured condition rules.

View source

Arguments ​

setFieldLayouts() ​

Since
5.1.0

Sets the possible field layouts that the condition could be working with.

View source

Arguments ​

  • $fieldLayouts ((\craft\models\FieldLayout|array)[])