Automattic\WooCommerce\EmailEditorVendor\Sabberworm\CSS\CSSList
CSSList::removeDeclarationBlockBySelector
Removes a declaration block from the CSS list if it matches all given selectors.
Метод класса: CSSList{}
Хуков нет.
Возвращает
void. Ничего (null).
Использование
$CSSList = new CSSList(); $CSSList->removeDeclarationBlockBySelector( $mSelector, $bRemoveAll );
- $mSelector(обязательный)
- .
- $bRemoveAll(true|false)
- whether to stop at the first declaration block found or remove all blocks.
По умолчанию:false
Код CSSList::removeDeclarationBlockBySelector() CSSList::removeDeclarationBlockBySelector WC 11.3.0
public function removeDeclarationBlockBySelector($mSelector, $bRemoveAll = false)
{
if ($mSelector instanceof DeclarationBlock) {
$mSelector = $mSelector->getSelectors();
}
if (!is_array($mSelector)) {
$mSelector = explode(',', $mSelector);
}
foreach ($mSelector as $iKey => &$mSel) {
if (!($mSel instanceof Selector)) {
if (!Selector::isValid($mSel)) {
throw new UnexpectedTokenException(
"Selector did not match '" . Selector::SELECTOR_VALIDATION_RX . "'.",
$mSel,
"custom"
);
}
$mSel = new Selector($mSel);
}
}
foreach ($this->aContents as $iKey => $mItem) {
if (!($mItem instanceof DeclarationBlock)) {
continue;
}
if ($mItem->getSelectors() == $mSelector) {
unset($this->aContents[$iKey]);
if (!$bRemoveAll) {
return;
}
}
}
}