You are here

public function AttributeMatchingExtension::translateDashMatch in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/css-selector/XPath/Extension/AttributeMatchingExtension.php \Symfony\Component\CssSelector\XPath\Extension\AttributeMatchingExtension::translateDashMatch()

Parameters

XPathExpr $xpath:

string $attribute:

string $value:

Return value

XPathExpr

File

vendor/symfony/css-selector/XPath/Extension/AttributeMatchingExtension.php, line 91

Class

AttributeMatchingExtension
XPath expression translator attribute extension.

Namespace

Symfony\Component\CssSelector\XPath\Extension

Code

public function translateDashMatch(XPathExpr $xpath, $attribute, $value) {
  return $xpath
    ->addCondition(sprintf('%1$s and (%1$s = %2$s or starts-with(%1$s, %3$s))', $attribute, Translator::getXpathLiteral($value), Translator::getXpathLiteral($value . '-')));
}