Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getSelector example
$items
=
[
]
;
foreach
(
$tour
as
$tour_id
=>
$tips
)
{
$tourEntity
=
$entities
[
$tour_id
]
;
foreach
(
$tips
as
$index
=>
$tip
)
{
$classes
=
[
'tip-module-' . Html::
getClass
(
$tourEntity
->
getModule
(
)
)
,
'tip-type-' . Html::
getClass
(
$tip
->
getPluginId
(
)
)
,
'tip-' . Html::
getClass
(
$tip
->
id
(
)
)
,
]
;
$selector
=
$tip
->
getSelector
(
)
;
$location
=
$tip
->
getLocation
(
)
;
$body_render_array
=
$tip
->
getBody
(
)
;
$body
=
(string)
\Drupal::
service
(
'renderer'
)
->
renderPlain
(
$body_render_array
)
;
$output
=
[
'body' =>
$body
,
'title' =>
$tip
->
getLabel
(
)
,
]
;
$selector
=
$tip
->
getSelector
(
)
;
'Element' =>
$this
->
translateElement
(
...
)
,
]
;
}
public
function
translateSelector
(
Node\SelectorNode
$node
, Translator
$translator
)
: XPathExpr
{
return
$translator
->
nodeToXPath
(
$node
->
getTree
(
)
)
;
}
public
function
translateCombinedSelector
(
Node\CombinedSelectorNode
$node
, Translator
$translator
)
: XPathExpr
{
return
$translator
->
addCombination
(
$node
->
getCombinator
(
)
,
$node
->
getSelector
(
)
,
$node
->
getSubSelector
(
)
)
;
}
public
function
translateNegation
(
Node\NegationNode
$node
, Translator
$translator
)
: XPathExpr
{
$xpath
=
$translator
->
nodeToXPath
(
$node
->
getSelector
(
)
)
;
$subXpath
=
$translator
->
nodeToXPath
(
$node
->
getSubSelector
(
)
)
;
$subXpath
->
addNameTest
(
)
;
if
(
$subXpath
->
getCondition
(
)
)
{
return
$xpath
->
addCondition
(
sprintf
(
'not(%s)',
$subXpath
->
getCondition
(
)
)
)
;
}