Automattic\WooCommerce\Vendor\Sabberworm\CSS\CSSList

CSSBlockList::getAllValuespublicWC 1.0

Returns all Value objects found recursively in Rules in the tree.

Method of the class: CSSBlockList{}

No Hooks.

Returns

Array. Value>

Usage

$CSSBlockList = new CSSBlockList();
$CSSBlockList->getAllValues( $element, $ruleSearchPatternOrSearchInFunctionArguments, $searchInFunctionArguments );
$element(CSSElement|string|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.
Default: null
$ruleSearchPatternOrSearchInFunctionArguments(string|true|false|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.
Default: null
$searchInFunctionArguments(true|false)
whether to also return Value objects used as Function arguments.
Default: false

Notes

  • See: RuleSet->getRules()

CSSBlockList::getAllValues() code WC 10.4.3

public function getAllValues(
    $element = null,
    $ruleSearchPatternOrSearchInFunctionArguments = null,
    $searchInFunctionArguments = false
) {
    if (\is_bool($ruleSearchPatternOrSearchInFunctionArguments)) {
        $searchInFunctionArguments = $ruleSearchPatternOrSearchInFunctionArguments;
        $searchString = null;
    } else {
        $searchString = $ruleSearchPatternOrSearchInFunctionArguments;
    }

    if ($element === null) {
        $element = $this;
    } elseif (\is_string($element)) {
        $searchString = $element;
        $element = $this;
    }

    $result = [];
    $this->allValues($element, $result, $searchString, $searchInFunctionArguments);
    return $result;
}