Skip to content

FieldConditionRuleTrait ​

Type
Trait
Namespace
craft\fields\conditions
Implemented by
craft\fields\conditions\CountryFieldConditionRule, craft\fields\conditions\DateFieldConditionRule, craft\fields\conditions\EmptyFieldConditionRule, craft\fields\conditions\LightswitchFieldConditionRule, craft\fields\conditions\NumberFieldConditionRule, craft\fields\conditions\OptionsFieldConditionRule, craft\fields\conditions\RelationalFieldConditionRule, craft\fields\conditions\TextFieldConditionRule
Since
4.0.0

FieldConditionRuleTrait implements the common methods and properties for custom fields’ query condition rule classes.

View source

Public Properties ​

PropertyDescription
fieldUidstring – The UUID of the custom field associated with this rule

fieldUid ​

Type
string
Default value
null

The UUID of the custom field associated with this rule

View source

Public Methods ​

MethodDescription
getConfig()Returns the rule’s portable config.
getExclusiveQueryParams()
getGroupLabel()Returns the optgroup label the condition rule should be grouped under.
getLabel()Returns the rule’s option label.
getLabelHint()Returns the rule’s option label hint.
matchElement()
modifyQuery()
setFieldUid()Sets the UUID of the custom field associated with this rule.

getConfig() ​

Returns the rule’s portable config.

View source

Returns ​

array

Throws ​

getExclusiveQueryParams() ​

View source

getGroupLabel() ​

Returns the optgroup label the condition rule should be grouped under.

View source

Returns ​

string, null

getLabel() ​

Returns the rule’s option label.

View source

Returns ​

string

getLabelHint() ​

Since
4.6.0

Returns the rule’s option label hint.

View source

Returns ​

string, null

matchElement() ​

View source

Arguments ​

  • $element

modifyQuery() ​

View source

Arguments ​

  • $query

setFieldUid() ​

Sets the UUID of the custom field associated with this rule.

View source

Arguments ​

Protected Methods ​

MethodDescription
defineRules()Returns the validation rules for attributes.
elementQueryParam()
field()Returns the custom field associated with this rule.
matchFieldValue()

defineRules() ​

Since
3.4.0

Returns the validation rules for attributes.

See \craft\fields\conditions\rules() for details about what should be returned.

Models should override this method instead of \craft\fields\conditions\rules() so \craft\fields\conditions\EVENT_DEFINE_RULES handlers can modify the class-defined rules.

View source

Returns ​

array

elementQueryParam() ​

View source

Returns ​

mixed

field() ​

Returns the custom field associated with this rule.

View source

Returns ​

craft\base\FieldInterface

Throws ​

matchFieldValue() ​

View source

Arguments ​

  • $value

Returns ​

mixed