WooCommerce Code Reference

CSSBlockList extends CSSList
in package

A `CSSBlockList` is a `CSSList` whose `DeclarationBlock`s are guaranteed to contain valid declaration blocks or at-rules.

Most CSSLists conform to this category but some at-rules (such as @keyframes) do not.

Table of Contents

__construct()  : mixed
__toString()  : string
addComments()  : void
append()  : void
Appends an item to the list of contents.
getAllValues()  : array<int, Value>
Returns all `Value` objects found recursively in `Rule`s in the tree.
getComments()  : array<array-key, Comment>
getContents()  : array<int, \Automattic\WooCommerce\Vendor\Sabberworm\CSS\RuleSet\RuleSet|\Automattic\WooCommerce\Vendor\Sabberworm\CSS\Property\Import|\Automattic\WooCommerce\Vendor\Sabberworm\CSS\Property\Charset|\Automattic\WooCommerce\Vendor\Sabberworm\CSS\CSSList\CSSList>
Returns the stored items.
insertBefore()  : mixed
Inserts an item in the CSS list before its sibling. If the desired sibling cannot be found, the item is appended at the end.
isRootList()  : bool
Return true if the list can not be further outdented. Only important when rendering.
prepend()  : void
Prepends an item to the list of contents.
remove()  : bool
Removes an item from the CSS list.
removeDeclarationBlockBySelector()  : void
Removes a declaration block from the CSS list if it matches all given selectors.
replace()  : bool
Replaces an item from the CSS list.
setComments()  : void
setContents()  : mixed
splice()  : void
Splices the list of contents.
allDeclarationBlocks()  : void
allRuleSets()  : void
allSelectors()  : void
allValues()  : void
renderListContents()  : string
identifierIs()  : bool
Tests an identifier for a given value. Since identifiers are all keywords, they can be vendor-prefixed.
parseAtRule()  : AtRuleBlockList|KeyFrame|Charset|CSSNamespace|Import|AtRuleSet|null
parseListItem()  : AtRuleBlockList|KeyFrame|Charset|CSSNamespace|Import|AtRuleSet|DeclarationBlock|null|false

Methods

getAllValues()

Returns all `Value` objects found recursively in `Rule`s in the tree.

public getAllValues([CSSElement|string|null $element = null ][, string|bool|null $ruleSearchPatternOrSearchInFunctionArguments = null ][, bool $searchInFunctionArguments = false ]) : array<int, Value>
Parameters
$element : CSSElement|string|null = null

This is the CSSList or RuleSet to start the search from (defaults to the whole document). If a string is given, it is used as a rule name filter. Passing a string for this parameter is deprecated in version 8.9.0, and will not work from v9.0; use the following parameter to pass a rule name filter instead.

$ruleSearchPatternOrSearchInFunctionArguments : string|bool|null = null

This allows filtering rules by property name (e.g. if "color" is passed, only Values from color properties will be returned, or if "font-" is provided, Values from all font rules, like font-size, and including font itself, will be returned). If a Boolean is provided, it is treated as the $searchInFunctionArguments argument. Passing a Boolean for this parameter is deprecated in version 8.9.0, and will not work from v9.0; use the $searchInFunctionArguments parameter instead.

$searchInFunctionArguments : bool = false

whether to also return Value objects used as Function arguments.

Tags
see

RuleSet->getRules()

Return values
array<int, Value>

getContents()

Returns the stored items.

public getContents() : array<int, \Automattic\WooCommerce\Vendor\Sabberworm\CSS\RuleSet\RuleSet|\Automattic\WooCommerce\Vendor\Sabberworm\CSS\Property\Import|\Automattic\WooCommerce\Vendor\Sabberworm\CSS\Property\Charset|\Automattic\WooCommerce\Vendor\Sabberworm\CSS\CSSList\CSSList>
Return values
array<int, \Automattic\WooCommerce\Vendor\Sabberworm\CSS\RuleSet\RuleSet|\Automattic\WooCommerce\Vendor\Sabberworm\CSS\Property\Import|\Automattic\WooCommerce\Vendor\Sabberworm\CSS\Property\Charset|\Automattic\WooCommerce\Vendor\Sabberworm\CSS\CSSList\CSSList>

removeDeclarationBlockBySelector()

Removes a declaration block from the CSS list if it matches all given selectors.

public removeDeclarationBlockBySelector(DeclarationBlock|array<array-key, Selector>|string $mSelector[, bool $bRemoveAll = false ]) : void
Parameters
$mSelector : DeclarationBlock|array<array-key, Selector>|string

the selectors to match

$bRemoveAll : bool = false

whether to stop at the first declaration block found or remove all blocks

Return values
void

setContents()

public setContents(array<int, \Automattic\WooCommerce\Vendor\Sabberworm\CSS\RuleSet\RuleSet|\Automattic\WooCommerce\Vendor\Sabberworm\CSS\Property\Import|\Automattic\WooCommerce\Vendor\Sabberworm\CSS\Property\Charset|\Automattic\WooCommerce\Vendor\Sabberworm\CSS\CSSList\CSSList> $aContents) : mixed
Parameters
$aContents : array<int, \Automattic\WooCommerce\Vendor\Sabberworm\CSS\RuleSet\RuleSet|\Automattic\WooCommerce\Vendor\Sabberworm\CSS\Property\Import|\Automattic\WooCommerce\Vendor\Sabberworm\CSS\Property\Charset|\Automattic\WooCommerce\Vendor\Sabberworm\CSS\CSSList\CSSList>
Return values
mixed

splice()

Splices the list of contents.

public splice(int $iOffset[, int $iLength = null ][, array<int, \Automattic\WooCommerce\Vendor\Sabberworm\CSS\RuleSet\RuleSet|\Automattic\WooCommerce\Vendor\Sabberworm\CSS\CSSList\CSSList|\Automattic\WooCommerce\Vendor\Sabberworm\CSS\Property\Import|\Automattic\WooCommerce\Vendor\Sabberworm\CSS\Property\Charset> $mReplacement = null ]) : void
Parameters
$iOffset : int
$iLength : int = null
$mReplacement : array<int, \Automattic\WooCommerce\Vendor\Sabberworm\CSS\RuleSet\RuleSet|\Automattic\WooCommerce\Vendor\Sabberworm\CSS\CSSList\CSSList|\Automattic\WooCommerce\Vendor\Sabberworm\CSS\Property\Import|\Automattic\WooCommerce\Vendor\Sabberworm\CSS\Property\Charset> = null
Return values
void

allValues()

protected allValues(CSSElement|string $oElement, array<int, Value&$aResult[, string|null $sSearchString = null ][, bool $bSearchInFunctionArguments = false ]) : void
Parameters
$oElement : CSSElement|string
$aResult : array<int, Value>
$sSearchString : string|null = null
$bSearchInFunctionArguments : bool = false
Return values
void

identifierIs()

Tests an identifier for a given value. Since identifiers are all keywords, they can be vendor-prefixed.

private static identifierIs(string $sIdentifier, string $sMatch) : bool

We need to check for these versions too.

Parameters
$sIdentifier : string
$sMatch : string
Return values
bool