public function getFields(string $table, array $options = []): array
    {
        $fields = [];

        if (!$table) {
            return $fields;
        }

        Controller::loadDataContainer($table);
        System::loadLanguageFile($table);

        if (!isset($GLOBALS['TL_DCA'][$table]['fields'])) {
            return $fields;
        }

        foreach ($GLOBALS['TL_DCA'][$table]['fields'] as $name => $data) {
            // restrict to certain input types
            if (isset($options['inputTypes']) && \is_array($options['inputTypes']) && !empty($options['inputTypes']) && !\in_array($data['inputType'], $options['inputTypes'])) {
                continue;
            }

            // restrict to certain dca eval
            if (isset($options['evalConditions']) && \is_array($options['evalConditions']) && !empty($options['evalConditions'])) {
                foreach ($options['evalConditions'] as $key => $value) {
                    if ($data['eval'][$key] !== $value) {
                        continue 2;
                    }
                }
            }

            if (isset($options['localizeLabels']) && !$options['localizeLabels']) {
                $fields[$name] = $name;
            } else {
                $label = $name;

                if (isset($data['label'][0]) && $data['label'][0]) {
                    $label .= ' <span style="display: inline; color:#999; padding-left:3px">['.$data['label'][0].']</span>';
                }

                $fields[$name] = $label;
            }
        }

        if (!isset($options['skipSorting']) || !$options['skipSorting']) {
            asort($fields);
        }

        return $fields;
    }