protected function ConfigPagesValueAccess::compareValues in Config Pages 8.2
Same name and namespace in other branches
- 8.3 src/Plugin/Condition/ConfigPagesValueAccess.php \Drupal\config_pages\Plugin\Condition\ConfigPagesValueAccess::compareValues()
Compare values based on operator.
Return value
bool TRUE if comprising match.
1 call to ConfigPagesValueAccess::compareValues()
- ConfigPagesValueAccess::evaluate in src/
Plugin/ Condition/ ConfigPagesValueAccess.php - Evaluates the condition and returns TRUE or FALSE accordingly.
File
- src/
Plugin/ Condition/ ConfigPagesValueAccess.php, line 253
Class
- ConfigPagesValueAccess
- Provides a 'Access by ConfigPage field value' condition.
Namespace
Drupal\config_pages\Plugin\ConditionCode
protected function compareValues($value, $field_value, $operator) {
// Compare values according to operator.
switch ($operator) {
case '==':
$result = $field_value == $value;
break;
case '<':
$result = $field_value < $value;
break;
case '<=':
$result = $field_value <= $value;
break;
case '!=':
$result = $field_value != $value;
break;
case '>=':
$result = $field_value >= $value;
break;
case '>':
$result = $field_value > $value;
break;
case 'isset':
$result = !empty($field_value) === !empty($value);
break;
default:
$result = FALSE;
}
return $result;
}