Automattic\WooCommerce\EmailEditorVendor\Sabberworm\CSS\CSSList

CSSList::replace │ public │ WC 1.0

Replaces an item from the CSS list.

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

Хуков нет.

Возвращает

bool.

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

$CSSList = new CSSList();
$CSSList->replace( $oOldItem, $mNewItem );
$oOldItem(RuleSet|Import|Charset|CSSList) (обязательный)
May be a RuleSet (most likely a DeclarationBlock), an Import, a Charset or another CSSList (most likely a MediaQuery).
$mNewItem(обязательный)
.

Код CSSList::replace() WC 11.3.0

public function replace($oOldItem, $mNewItem)
{
    $iKey = array_search($oOldItem, $this->aContents, true);
    if ($iKey !== false) {
        if (is_array($mNewItem)) {
            array_splice($this->aContents, $iKey, 1, $mNewItem);
        } else {
            array_splice($this->aContents, $iKey, 1, [$mNewItem]);
        }
        return true;
    }
    return false;
}