Automattic\WooCommerce\Vendor\Pelago\Emogrifier\HtmlProcessor

CssToAttributeConverter::mapBackgroundProperty │ private │ WC 1.0

Метод класса: CssToAttributeConverter{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// private - только в коде основоного (родительского) класса
$result = $this->mapBackgroundProperty( $node, $value ): void;
$node(DOMElement) (обязательный)
node to apply styles to.
$value(строка) (обязательный)
the value of the style rule to map.

Код CssToAttributeConverter::mapBackgroundProperty() WC 11.2.1

private function mapBackgroundProperty(\DOMElement $node, string $value): void
{
    // parse out the color, if any
    /** @var array<int, string> $styles */
    $styles = \explode(' ', $value, 2);
    $first = $styles[0];
    if (\is_numeric($first[0]) || \strncmp($first, 'url', 3) === 0) {
        return;
    }

    // as this is not a position or image, assume it's a color
    $node->setAttribute('bgcolor', $first);
}