Automattic\WooCommerce\Vendor\Sabberworm\CSS\CSSList
CSSList::replace
Replaces an item from the CSS list.
Method of the class: CSSList{}
No Hooks.
Returns
true|false.
Usage
$CSSList = new CSSList(); $CSSList->replace( $oOldItem, $mNewItem );
- $oOldItem(RuleSet|Import|Charset|CSSList) (required)
- May be a
RuleSet(most likely aDeclarationBlock), anImport, aCharsetor anotherCSSList(most likely aMediaQuery). - $mNewItem(required)
- .
CSSList::replace() CSSList::replace code WC 10.4.3
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;
}