Automattic\WooCommerce\Vendor\Pelago\Emogrifier\HtmlProcessor
CssVariableEvaluator::getPropertyValueReplacement
Callback function for {@see replaceVariablesInPropertyValue} performing regular expression replacement.
Method of the class: CssVariableEvaluator{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->getPropertyValueReplacement( $matches ): string;
- $matches(array) (required)
- .
CssVariableEvaluator::getPropertyValueReplacement() CssVariableEvaluator::getPropertyValueReplacement code WC 10.8.1
private function getPropertyValueReplacement(array $matches): string
{
$variableName = $matches[1];
if (isset($this->currentVariableDefinitions[$variableName])) {
$variableValue = $this->currentVariableDefinitions[$variableName];
} else {
$fallbackValueSeparator = $matches[2] ?? '';
if ($fallbackValueSeparator !== '') {
$fallbackValue = $matches[3];
// The fallback value may use other CSS variables, so recurse
$variableValue = $this->replaceVariablesInPropertyValue($fallbackValue);
} else {
$variableValue = $matches[0];
}
}
return $variableValue;
}