Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Translator.php

function Translator::cssToXPath

Overrides TranslatorInterface::cssToXPath

File

vendor/symfony/css-selector/XPath/Translator.php, line 90

Class

Translator
XPath expression translator interface.

Namespace

Symfony\Component\CssSelector\XPath

Code

public function cssToXPath(string $cssExpr, string $prefix = 'descendant-or-self::') : string {
    $selectors = $this->parseSelectors($cssExpr);
    
    /** @var SelectorNode $selector */
    foreach ($selectors as $index => $selector) {
        if (null !== $selector->getPseudoElement()) {
            throw new ExpressionErrorException('Pseudo-elements are not supported.');
        }
        $selectors[$index] = $this->selectorToXPath($selector, $prefix);
    }
    return implode(' | ', $selectors);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal