Automattic\WooCommerce\Vendor\Symfony\Component\CssSelector\XPath\Extension
AttributeMatchingExtension::translateSuffixMatch
Method of the class: AttributeMatchingExtension{}
No Hooks.
Returns
null. Nothing (null).
Usage
$AttributeMatchingExtension = new AttributeMatchingExtension(); $AttributeMatchingExtension->translateSuffixMatch( $xpath, $attribute, ?string $value ): XPathExpr;
- $xpath(XPathExpr) (required)
- .
- $attribute(string) (required)
- .
- ?string $value(required)
- .
AttributeMatchingExtension::translateSuffixMatch() AttributeMatchingExtension::translateSuffixMatch code WC 10.7.0
public function translateSuffixMatch(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
{
return $xpath->addCondition($value ? sprintf(
'%1$s and substring(%1$s, string-length(%1$s)-%2$s) = %3$s',
$attribute,
\strlen($value) - 1,
Translator::getXpathLiteral($value)
) : '0');
}