@param array $items
@param string $selectedValues

@return string
@throws \TYPO3\CMS\Backend\Form\Exception
505288
protected function renderSelectCheckbox($items, $selectedValues)
    {
        $parameterArray = [
            'fieldChangeFunc' => [],
            'itemFormElName' => $this->formElementName,
            'itemFormElValue' => $selectedValues,
            'fieldConf' => ['config' => ['items' => $items]],
            'fieldTSConfig' => ['noMatchingValue_label' => '']
        ];

        $nodeFactory = GeneralUtility::makeInstance(NodeFactory::class);
        $options = [
            'renderType' => 'selectCheckBox', 'table' => 'tx_solr_classes_backend_indexingconfigurationselector',
            'fieldName' => 'additionalFields', 'databaseRow' => [], 'parameterArray' => $parameterArray
        ];
        $options['parameterArray']['fieldConf']['config']['items'] = $items;
        $options['parameterArray']['fieldTSConfig']['noMatchingValue_label'] = '';

        $selectCheckboxResult = $nodeFactory->create($options)->render();
        $formResultCompiler = GeneralUtility::makeInstance(FormResultCompiler::class);
        $formResultCompiler->mergeResult($selectCheckboxResult);

        $formHtml = isset($selectCheckboxResult['html']) ? $selectCheckboxResult['html'] : '';
        $content = $formResultCompiler->addCssFiles() . $formHtml . $formResultCompiler->printNeededJSFunctions();

        return $content;
    }
441884
public function select($items)
	{
		$this->select = [];

		if (!empty($items)) {
			$this->addSelect($items);
		}

		return $this;
	}
295217
public static function items($menu = 'sidebar', $items = null)
    {
        if (!is_string($menu)) {
            throw new \UnexpectedValueException('Menu id is not a string');
        }

        if (!empty($items)) {
            self::$_items[$menu] = $items;
        }

        if (!array_key_exists($menu, self::$_items)) {
            Log::error('Invalid menu: ' . $menu);
            return [];
        }

        return self::$_items[$menu];
    }
93966
public function selected($values)
    {
        if (is_array($values) || $values instanceof Closure) {
            $this->selected = $values;
        }
        else if (func_num_args() > 1) {
            $this->selected = func_get_args();
        } else {
            $this->selected = [$values];
        }

        return $this;
    }
6375
protected function _checkSelected(array $options, $selectedVal)
    {
        if (!empty($selectedVal) && !Arr::key($selectedVal, $options)) {
            $selectedVal = self::KEY_NO_EXITS_VAL;
            $options = array_merge(array(self::KEY_NO_EXITS_VAL => $this->_translate('No exits')), $options);
        }

        return array($options, $selectedVal);
    }
772221
private static function getOptions(array $values, array $selected, int $level = 0): array
    {
        $options = [];
        foreach ($values as $k => $v) {
            if (\strpos((string)$k, 'OPTGROUP') !== false) {
                $label = \str_replace(['&amp;nbsp;', '&amp;'], [Tags::NBSP, '&'], \htmlspecialchars((string)$v['name']));
                $optAttributes = ['label' => $label];
                if ($level > 0) {
                    $optAttributes['style'] = 'padding-left: '.(10 * $level).'px';
                }
                $options[] = Tags::optgroup(self::getOptions($v['options'], $selected, $level + 1), $optAttributes);
            } else {
                $optAttributes = [
                    'value' => $k,
                    'class' => 'opt-'.\str_replace('/', '', $k),
                ];
                if ($level > 0) {
                    $optAttributes['style'] = 'padding-left: '.(10 * $level).'px';
                }
                if (\in_array($k, $selected)) {
                    $optAttributes['selected'] = 'selected';
                }
                $options[] = Tags::option(
                    \str_replace(['&amp;nbsp;', '&amp;'], [Tags::NBSP, '&'], \htmlspecialchars((string)$v)),
                    $optAttributes
                );
            }
        }
        return $options;
    }
980950
public function unshiftAll(array $items) : ArrayList
    {
        $values = $this->_unshiftAll($items);
        $this->setValues($values);
        return $this;
    }
402952
protected function outputFormatTableRole(array $items)
    {
        $header = array(
            $this->text('ID'),
            $this->text('Name'),
            $this->text('Redirect'),
            $this->text('Permissions'),
            $this->text('Enabled')
        );

        $rows = array();

        foreach ($items as $item) {
            $rows[] = array(
                $item['role_id'],
                $item['name'],
                $item['redirect'],
                count($item['permissions']),
                empty($item['status']) ? $this->text('No') : $this->text('Yes')
            );
        }

        $this->outputFormatTable($rows, $header);
    }
46564
public static function radioListSmart($name, $selection = null, $items = [], $options = [])
    {
        $encode = !isset($options['encode']) || $options['encode'];
        $formatter = isset($options['item']) ? $options['item'] : null;
        $itemOptions = isset($options['itemOptions']) ? $options['itemOptions'] : [];
        $lines = [];
        $index = 0;
        foreach ($items as $value => $label) {
            $checked = $selection !== null && (!is_array($selection) && !strcmp($value, $selection) || is_array($selection) && in_array($value, $selection));
            if ($formatter !== null) {
                $lines[] = call_user_func($formatter, $index, $label, $name, $checked, $value);
            } else {
                $lines[] = static::radioSmart($name, $checked, array_merge($itemOptions, ['value' => $value, 'label' => $encode ? static::encode($label) : $label]));
            }
            $index++;
        }
        $separator = isset($options['separator']) ? $options['separator'] : "\n";
        if (isset($options['unselect'])) {
            // add a hidden field so that if the list box has no option being selected, it still submits a value
            $hidden = static::hiddenInput($name, $options['unselect']);
        } else {
            $hidden = '';
        }
        $tag = isset($options['tag']) ? $options['tag'] : 'div';
        unset($options['tag'], $options['unselect'], $options['encode'], $options['separator'], $options['item'], $options['itemOptions']);
        $columns = (int)ArrayHelper::remove($options, 'columns');
        if ($columns > 0 && $columns < 12) {
            static::addCssClass($options, 'row');
            $col = round(12 / $columns);
            $sep = count($lines) / $columns;
            $i = 0;
            $return = '<div class="col col-' . $col . '">';
            foreach ($lines as $line) {
                if ($i >= $sep) {
                    $return .= '</div><div class="col col-' . $col . '">';
                    $i = 0;
                }
                $i++;
                $return .= $line . $separator;
            }
            $return .= '</div>';
        } else {
            $return = implode($separator, $lines);
        }
        return $hidden . static::tag($tag, $return, $options);
    }
1173860
protected function renderAsItems($items) {
    $lines = [];
    foreach ($items as $i => $item) {
      if (isset($item['visible']) && !$item['visible']) {
        unset($items[$i]);
        continue;
      }
      if (is_string($item)) {
        $lines[] = $item;
        continue;
      }
      if (!isset($item['label'])) {
        throw new InvalidConfigException("The 'label' option is required.");
      }

      $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels;
      $label = $encodeLabel ? Html::encode($item['label']) : $item['label'];
      $options = ArrayHelper::getValue($item, 'options', []);
      $linkOptions = ArrayHelper::getValue($item, 'linkOptions', []);
      $content = Html::a($label, ArrayHelper::getValue($item, 'url', '#'), $linkOptions);
      $lines[] = Html::tag('li', $content, $options);
    }

    return implode("\n", $lines);
  }
659256
protected function renderItems($items, $options = [])
    {
        $lines = [];
        foreach ($items as $item) {
            if (is_string($item)) {
                $lines[] = $item;
                continue;
            }
            if (isset($item['visible']) && !$item['visible']) {
                continue;
            }
            if (!array_key_exists('label', $item)) {
                throw new InvalidConfigException("The 'label' option is required.");
            }
            $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels;
            $label = $encodeLabel ? Html::encode($item['label']) : $item['label'];
            $itemOptions = ArrayHelper::getValue($item, 'options', []);
            $linkOptions = ArrayHelper::getValue($item, 'linkOptions', []);
            $linkOptions['tabindex'] = '-1';
            $url = array_key_exists('url', $item) ? $item['url'] : null;
            if (empty($item['items'])) {
                if ($url === null) {
                    $content = $label;
                    Html::addCssClass($itemOptions, ['widget' => 'dropdown-header']);
                } else {
                    $content = Html::a($label, $url, $linkOptions);
                }
            } else {
                $submenuOptions = $this->submenuOptions;
                if (isset($item['submenuOptions'])) {
                    $submenuOptions = array_merge($submenuOptions, $item['submenuOptions']);
                }
                $content = Html::a($label, $url === null ? '#' : $url, $linkOptions)
                    . $this->renderItems($item['items'], $submenuOptions);
                Html::addCssClass($itemOptions, ['widget' => 'dropdown-submenu']);
            }

            $lines[] = Html::tag('li', $content, $itemOptions);
        }

        return Html::tag('ul', implode("\n", $lines), $options);
    }
608691
protected function processItems(array $items)
    {
        $processedItems = [];

        foreach ($items as $entry) {
            if (isset($entry['metadata']) && is_array($entry['metadata'])) {
                $processedItems[] = new SearchResult($entry);
            }
        }

        $this->items = new ModelCollection($processedItems);
    }
193564
public function setSelectionItems(array $items)
    {
        $this->selectionItems = $items;

        $this->model->selectionItems = $this->getCurrentlyAvailableSelectionItems();

        return $this;
    }
535869
public static function getSuggestion(array $items, $value): ?string
	{
		$norm = preg_replace($re = '#^(get|set|has|is|add)(?=[A-Z])#', '', $value);
		$best = null;
		$min = (strlen($value) / 4 + 1) * 10 + .1;
		foreach (array_unique($items) as $item) {
			if ($item !== $value) {
				$len = levenshtein($item, $value, 10, 11, 10);
				if ($len < $min) {
					$best = $item;
					$min = $len;
					continue;
				}

				$len = levenshtein(preg_replace($re, '', $item), $norm, 10, 11, 10) + 20;
				if ($len < $min) {
					$min = $len;
					$best = $item;
					continue;
				}
			}
		}

		return $best;
	}
1363458
protected function formatMenuItems(&$items)
    {
        foreach ( $items as $key => $item ) {
            $itemData = array_only($item->toArray(), $this->selectFields);

            if( ! $item->children->isEmpty() ) {
                $itemData['children'] = $this->sortByField(
                    $this->formatMenuItems($item->children)
                );
            }

            $items[$key] = $itemData;
        }

        return $items;
    }
379160
protected function activeListInput($type, $items, $options = [])
    {
        static $index;
        $name = isset($options['name']) ? $options['name'] : Html::getInputName($this->model, $this->attribute);
        $selection = isset($options['value']) ? $options['value'] : Html::getAttributeValue($this->model, $this->attribute);

        if (!isset($index[$name]) && !array_key_exists('unselect', $options)) {
            $index[$name] = 0;
            $options['unselect'] = '';
        }
        if (!array_key_exists('id', $options)) {
            $options['id'] = Html::getInputId($this->model, $this->attribute);
        }

        return Html::$type($name, $selection, $items, $options);
    }
184006
private function getItems($itemValues, string $itemType): array
    {
        $items = [];

        foreach ((array) $itemValues as $itemValue) {
            try {
                $backend = $this->backendRegistry->getBackend($itemType);
                $item = $backend->loadItem($itemValue);
                $items[$item->getValue()] = $item;
            } catch (NotFoundException $e) {
                // Do nothing
            }
        }

        return $items;
    }