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.
Public Properties ​
Property | Description |
---|---|
fieldUid | string – 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
Public Methods ​
Method | Description |
---|---|
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.
Returns ​
Throws ​
- yii\base\InvalidConfigException
if the rule is misconfigured
getExclusiveQueryParams()
​
getGroupLabel()
​
Returns the optgroup label the condition rule should be grouped under.
Returns ​
getLabel()
​
Returns the rule’s option label.
Returns ​
getLabelHint()
​
- Since
- 4.6.0
Returns the rule’s option label hint.
Returns ​
matchElement()
​
Arguments ​
$element
modifyQuery()
​
Arguments ​
$query
setFieldUid()
​
Sets the UUID of the custom field associated with this rule.
Arguments ​
$uid
(string)
Protected Methods ​
Method | Description |
---|---|
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.
Returns ​
elementQueryParam()
​
Returns ​
mixed
field()
​
Returns the custom field associated with this rule.
Returns ​
Throws ​
- yii\base\InvalidConfigException
if fieldUid is invalid
matchFieldValue()
​
Arguments ​
$value
Returns ​
mixed