Automattic\WooCommerce\EmailEditorVendor\Pelago\Emogrifier\HtmlProcessor
CssToAttributeConverter::mapWidthOrHeightProperty
Метод класса: CssToAttributeConverter{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->mapWidthOrHeightProperty( $node, $value, $property ): void;
- $node(DOMElement) (обязательный)
- node to apply styles to.
- $value(строка) (обязательный)
- the value of the style rule to map.
- $property(строка) (обязательный)
- the name of the CSS property to map.
Код CssToAttributeConverter::mapWidthOrHeightProperty() CssToAttributeConverter::mapWidthOrHeightProperty WC 11.3.0
private function mapWidthOrHeightProperty(\DOMElement $node, string $value, string $property): void
{
$preg = new Preg();
// only parse values in px and %, but not values like "auto"
if ($preg->match('/^(\\d+)(\\.(\\d+))?(px|%)$/', $value) === 0) {
return;
}
$number = $preg->replace('/[^0-9.%]/', '', $value);
$node->setAttribute($property, $number);
}