Automattic\WooCommerce\EmailEditorVendor\Sabberworm\CSS\CSSList
CSSList::replace
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 aDeclarationBlock), anImport, aCharsetor anotherCSSList(most likely aMediaQuery). - $mNewItem(обязательный)
- .
Код CSSList::replace() 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;
}