95 public function tree($array, $positionKey)
97 $output =
'<ul class="list-tree text-monospace">';
99 $positionKey = $positionKey .
'.';
102 $uriBuilder = GeneralUtility::makeInstance(\
TYPO3\CMS\Backend\Routing\UriBuilder::class);
103 foreach ($array as $key => $value) {
104 $depth = $positionKey . $key;
105 if (is_object($value) && !$value instanceof \Traversable) {
106 $value = (array)$value;
108 $isArray = is_array($value) || $value instanceof \Traversable;
109 $isResult = (bool)$this->searchKeys[$depth];
111 $output .=
'<li' . ($isResult ?
' class="active"' :
'') .
'>';
112 $output .=
'<span class="list-tree-group">';
113 if ($isArray && !$this->expAll) {
114 $goto =
'a' . substr(md5($depth), 0, 6);
115 $output .=
'<a class="list-tree-control' . ($isExpanded ?
' list-tree-control-open' :
' list-tree-control-closed') .
'" id="' . $goto .
'" href="' . htmlspecialchars((
string)$uriBuilder->buildUriFromRoutePath(GeneralUtility::_GP(
'route')) .
'&node[' . rawurlencode($depth) .
']=' . ($isExpanded ? 0 : 1) .
'#' . $goto) .
'"><i class="fa"></i></a> ';
119 $output .=
' = <span class="list-tree-value">' . htmlspecialchars($value) .
'</span>';
145 $label = htmlspecialchars($label);
147 $uriBuilder = GeneralUtility::makeInstance(\
TYPO3\CMS\Backend\Routing\UriBuilder::class);
149 if ($this->varName && !$this->dontLinkVar) {
150 $variableName = $this->varName
151 .
'[\'' . str_replace(
'.',
'\'][\
'', $depth) .
'\'] =
'
152 . (!MathUtility::canBeInterpretedAsInteger($theValue) ? '\
''
153 . addslashes($theValue) .
'\'' : $theValue) .
'; ';
154 $label =
'<a class="list-tree-label" href="'
155 . htmlspecialchars((
string)$uriBuilder->buildUriFromRoutePath(GeneralUtility::_GP(
'route'))
156 .
'&varname=' . urlencode($variableName))
157 .
'#varname">' . $label .
'</a>';
159 return '<span class="list-tree-label">' . $label .
'</span>';
172 public function getSearchKeys($keyArr, $depth_in, $searchString, $keyArray)
175 $depth_in = $depth_in .
'.';
177 foreach ($keyArr as $key => $value) {
178 $depth = $depth_in . $key;
179 $deeper = is_array($keyArr[$key]);
180 if ($this->regexMode) {
182 is_scalar($keyArr[$key]) && preg_match(
'/' . $searchString .
'/', $keyArr[$key])
183 || $this->searchKeysToo && preg_match(
'/' . $searchString .
'/', $key)
185 $this->searchKeys[$depth] = 1;
189 is_scalar($keyArr[$key]) && stristr($keyArr[$key], $searchString)
190 || $this->searchKeysToo && stristr($key, $searchString)
192 $this->searchKeys[$depth] = 1;
196 $cS = count($this->searchKeys);
197 $keyArray = $this->
getSearchKeys($keyArr[$key], $depth, $searchString, $keyArray);
198 if ($cS != count($this->searchKeys)) {
199 $keyArray[$depth] = 1;
216 foreach ($arr as $theK => $theV) {
217 $theKeyParts = explode(
'.', $theK);
219 $c = count($theKeyParts);
221 foreach ($theKeyParts as $p) {
223 $depth .= ($depth ?
'.' :
'') . $p;
224 $tsbrArray[$depth] = $c == $a ? $theV : 1;
228 foreach ($tsbrArray as $theK => $theV) {
230 $settings[$theK] = 1;
232 unset($settings[$theK]);