DisplayCondition
in package
Base class for display conditions
This is known as the Context Engine, and is a set of display rules which affect which widgets (content blocks) are shown or hidden on the page
Table of Contents
Methods
- getOperators() : array<string|int, mixed>
- Return the list of operators for the condition value Common values would be 'equals', 'not equals', 'less than', 'contains', etc
- getParamType() : string
- Return the type of parameter for UI display Only two types are supported - 'text' or 'dropdown'
- getParamValues() : array<string|int, mixed>
- Return the available values for dropdowns
- match() : bool
- Does a given condition match?
Methods
getOperators()
Return the list of operators for the condition value Common values would be 'equals', 'not equals', 'less than', 'contains', etc
public
abstract getOperators() : array<string|int, mixed>
Return values
array<string|int, mixed> —Key is internal value (e.g. '=') and value is the label (e.g. 'Equals')
getParamType()
Return the type of parameter for UI display Only two types are supported - 'text' or 'dropdown'
public
abstract getParamType() : string
Return values
stringgetParamValues()
Return the available values for dropdowns
public
getParamValues() : array<string|int, mixed>
Return values
array<string|int, mixed> —Key is internal value (e.g. 'desktop') and value is the label (e.g. 'Desktop')
match()
Does a given condition match?
public
abstract match(array<string|int, mixed> $env, string $op, string $val) : bool
Parameters
- $env : array<string|int, mixed>
-
Environment, such as page id etc
- $op : string
-
string One of the keys from the array returned by DisplayCondition::getOperators
- $val : string
-
string Entered value OR one of the keys from DisplayCondition::getParamValues
Return values
bool —True of condition matches, false if it does not