ConditionRuleInterface

Type
Interface
Namespace
craft\base\conditions
Extends
craft\base\ComponentInterface
Implemented by
craft\base\conditions\BaseConditionRule, craft\base\conditions\BaseDateRangeConditionRule, craft\base\conditions\BaseElementSelectConditionRule, craft\base\conditions\BaseLightswitchConditionRule, craft\base\conditions\BaseMultiSelectConditionRule, craft\base\conditions\BaseNumberConditionRule, craft\base\conditions\BaseSelectConditionRule, craft\base\conditions\BaseTextConditionRule, craft\elements\conditions\DateCreatedConditionRule, craft\elements\conditions\DateUpdatedConditionRule, craft\elements\conditions\ElementConditionRuleInterface, craft\elements\conditions\HasUrlConditionRule, craft\elements\conditions\IdConditionRule, craft\elements\conditions\LevelConditionRule, craft\elements\conditions\RelatedToConditionRule, craft\elements\conditions\SiteConditionRule, craft\elements\conditions\SlugConditionRule, craft\elements\conditions\StatusConditionRule, craft\elements\conditions\TitleConditionRule, craft\elements\conditions\UriConditionRule, craft\elements\conditions\addresses\AdministrativeAreaConditionRule, craft\elements\conditions\addresses\CountryConditionRule, craft\elements\conditions\assets\DateModifiedConditionRule, craft\elements\conditions\assets\FileSizeConditionRule, craft\elements\conditions\assets\FileTypeConditionRule, craft\elements\conditions\assets\FilenameConditionRule, craft\elements\conditions\assets\HasAltConditionRule, craft\elements\conditions\assets\HeightConditionRule, craft\elements\conditions\assets\SavableConditionRule, craft\elements\conditions\assets\UploaderConditionRule, craft\elements\conditions\assets\ViewableConditionRule, craft\elements\conditions\assets\VolumeConditionRule, craft\elements\conditions\assets\WidthConditionRule, craft\elements\conditions\categories\GroupConditionRule, craft\elements\conditions\entries\AuthorConditionRule, craft\elements\conditions\entries\AuthorGroupConditionRule, craft\elements\conditions\entries\ExpiryDateConditionRule, craft\elements\conditions\entries\PostDateConditionRule, craft\elements\conditions\entries\SavableConditionRule, craft\elements\conditions\entries\SectionConditionRule, craft\elements\conditions\entries\TypeConditionRule, craft\elements\conditions\entries\ViewableConditionRule, craft\elements\conditions\tags\GroupConditionRule, craft\elements\conditions\users\AdminConditionRule, craft\elements\conditions\users\CredentialedConditionRule, craft\elements\conditions\users\EmailConditionRule, craft\elements\conditions\users\FirstNameConditionRule, craft\elements\conditions\users\GroupConditionRule, craft\elements\conditions\users\LastLoginDateConditionRule, craft\elements\conditions\users\LastNameConditionRule, craft\elements\conditions\users\UsernameConditionRule, 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

ConditionRuleInterface defines the common interface to be implemented by condition rule classes.

A base implementation is provided by craft\base\conditions\BaseConditionRule.

View source (opens new window)

# Public Methods

Method Description
displayName() Returns the display name of this class.
extraFields() (opens new window) Returns the list of additional fields that can be returned by toArray() (opens new window) in addition to those listed in fields() (opens new window).
fields() (opens new window) Returns the list of fields that should be returned by default by toArray() (opens new window) when no specific fields are specified.
getAutofocus() Returns whether the rule’s type selector should be autofocused.
getCondition() Returns the condition associated with this rule.
getConfig() Returns the rule’s portable config.
getGroupLabel() Returns the optgroup label the condition rule should be grouped under.
getHtml() Returns the rule’s HTML for a condition builder.
getLabel() Returns the rule’s option label.
instance() (opens new window) Returns static class instance, which can be used to obtain meta information.
isSelectable() Returns whether the component should be selectable in component Type selects.
setAutofocus() Sets whether the rule’s type selector should be autofocused.
setCondition() Sets the condition associated with this rule.
supportsProjectConfig() Returns whether the rule is safe to include in conditions that are stored in the project config.
toArray() (opens new window) Converts the object into an array.

# getAutofocus()

Returns whether the rule’s type selector should be autofocused.

View source (opens new window)

Returns

boolean (opens new window)

# getCondition()

Returns the condition associated with this rule.

View source (opens new window)

Returns

craft\base\conditions\ConditionInterface

# getConfig()

Returns the rule’s portable config.

View source (opens new window)

Returns

array (opens new window)

Throws

# 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)

# getHtml()

Returns the rule’s HTML for a condition builder.

View source (opens new window)

Returns

string (opens new window)

# getLabel()

Returns the rule’s option label.

View source (opens new window)

Returns

string (opens new window)

# setAutofocus()

Sets whether the rule’s type selector should be autofocused.

View source (opens new window)

Arguments

# setCondition()

Sets the condition associated with this rule.

View source (opens new window)

Arguments

# supportsProjectConfig()

Returns whether the rule is safe to include in conditions that are stored in the project config.

View source (opens new window)

Returns

boolean (opens new window)