FieldConditionRuleTrait
- Type
- Trait
- Namespace
- craft\fields\conditions
- Implemented by
- 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 (opens new window)
# Public Properties
Property | Description |
---|---|
fieldUid | string (opens new window) – The UUID of the custom field associated with this rule |
# fieldUid
- Type
- string (opens new window)
- Default value
null
The UUID of the custom field associated with this rule
View source (opens new window)
# 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. |
matchElement() | |
modifyQuery() | |
setFieldUid() | Sets the UUID of the custom field associated with this rule. |
# getConfig()
Returns the rule’s portable config.
View source (opens new window)
Returns
Throws
- yii\base\InvalidConfigException (opens new window)
if the rule is misconfigured
# getExclusiveQueryParams()
View source (opens new window)
# getGroupLabel()
Returns the optgroup label the condition rule should be grouped under.
View source (opens new window)
Returns
string (opens new window), null (opens new window)
# getLabel()
Returns the rule’s option label.
View source (opens new window)
Returns
# matchElement()
View source (opens new window)
Arguments
$element
# modifyQuery()
View source (opens new window)
Arguments
$query
# setFieldUid()
Sets the UUID of the custom field associated with this rule.
View source (opens new window)
Arguments
$uid
(string (opens new window))
# 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.
View source (opens new window)
Returns
# elementQueryParam()
View source (opens new window)
Returns
mixed
# field()
Returns the custom field associated with this rule.
View source (opens new window)
Returns
Throws
- yii\base\InvalidConfigException (opens new window)
if fieldUid is invalid
# matchFieldValue()
View source (opens new window)
Arguments
$value
Returns
mixed