[TASK] DotsToBracketsViewHelper: Add option to render unquoted parts
This commit is contained in:
parent
3dbd981f97
commit
ccb3141487
@ -13,9 +13,18 @@ class DotsToBracketsViewHelper extends AbstractViewHelper
|
|||||||
RenderingContextInterface $renderingContext
|
RenderingContextInterface $renderingContext
|
||||||
) {
|
) {
|
||||||
$parts = explode('.', $renderChildrenClosure());
|
$parts = explode('.', $renderChildrenClosure());
|
||||||
$_ = '[\'';
|
$_ = '';
|
||||||
$_ .= implode('\'][\'', $parts);
|
foreach ($parts as $part) {
|
||||||
$_ .= '\']';
|
$_ .= '[';
|
||||||
|
if (substr($part, 0, 1) === '#') {
|
||||||
|
$_ .= substr($part, 1);
|
||||||
|
} else {
|
||||||
|
$_ .= '\'';
|
||||||
|
$_ .= $part;
|
||||||
|
$_ .= '\'';
|
||||||
|
}
|
||||||
|
$_ .= ']';
|
||||||
|
}
|
||||||
return $_;
|
return $_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user