Get configuration for field

@param string $typeName
@param string $fieldName
@param LeafType[] $operators

@return array
181082
private function getFieldConfiguration(string $typeName, string $fieldName, array $operators): array
    {
        return [
            'name' => $fieldName,
            'type' => $this->getFieldType($typeName, $fieldName, $operators),
        ];
    }
111598
private function getOperatorFieldName(string $className): string
    {
        $name = preg_replace('~OperatorType$~', '', Utils::getTypeName($className));

        return lcfirst($name);
    }
306728
public function getFieldTypes()
    {
        $fields = [];
        foreach ($this->fields as $name => $value) {
            $fields[$name] = isset($this->types[$name])
                ? $this->types[$name]
                : null
                ;
        }

        return $fields;
    }
267192
protected function getFilterDescription(string $fieldName, string $operator): array
    {
        return [
            sprintf('%s[%s]', $fieldName, $operator) => [
                'property' => $fieldName,
                'type' => 'string',
                'required' => false,
            ],
        ];
    }
404710
public static function generate(string $typeName, array $typeFields): string
    {
        $arguments = [];

        foreach ($typeFields as $fieldName => $field) {
            $className = get_class($field);
            // We can generate queries for all but Object types, as Object types are relations
            if (! in_array($className, self::$supportedGraphQLTypes)) {
                continue;
            }

            if ($field instanceof FullTextSearch) {
                $arguments[] = sprintf('%s: %s @fulltext', $fieldName, $field->name);
                continue;
            }

            // Add all our custom directives
            $arguments[] = sprintf('%s: %s @eq', $fieldName, $field->name);
            $arguments[] = sprintf('%s_not: %s @not', $fieldName, $field->name);
            $arguments[] = sprintf('%s_in: [%s] @in', $fieldName, $field->name);
            $arguments[] = sprintf('%s_not_in: [%s] @not_in', $fieldName, $field->name);

            if ($field instanceof EnumType) {
                continue;
            }

            if ($field instanceof StringType) {
                $arguments[] = sprintf('%s_contains: %s @contains', $fieldName, $field->name);
                $arguments[] = sprintf('%s_not_contains: %s @not_contains', $fieldName, $field->name);
                $arguments[] = sprintf('%s_starts_with: %s @starts_with', $fieldName, $field->name);
                $arguments[] = sprintf('%s_not_starts_with: %s @not_starts_with', $fieldName, $field->name);
                $arguments[] = sprintf('%s_ends_with: %s @not_ends_with', $fieldName, $field->name);

                continue;
            }


            $arguments[] = sprintf('%s_lt: %s @lt', $fieldName, $field->name);
            $arguments[] = sprintf('%s_lte: %s @lte', $fieldName, $field->name);
            $arguments[] = sprintf('%s_gt: %s @gt', $fieldName, $field->name);
            $arguments[] = sprintf('%s_gte: %s @gte', $fieldName, $field->name);
        }

        if (count($arguments) < 1) {
            return '';
        }

        $allQueryName = str_plural(lcfirst($typeName));
        $queryArguments = sprintf('(%s)', implode(', ', $arguments));
        $allQuery = sprintf('    %1$s%2$s: [%3$s]! @all(model: "%3$s")', $allQueryName, $queryArguments, $typeName);

        $paginatedQueryName = str_plural(lcfirst($typeName)) . 'Paginated';
        $paginatedQuery = sprintf('    %1$s%2$s: [%3$s]! @paginate(model: "%3$s")', $paginatedQueryName, $queryArguments, $typeName);

        if (config('lighthouse-utils.authorization')) {
            $allPermission = sprintf('All%1$s', str_plural($typeName));
            $allQuery .= sprintf(' @can(if: "%1$s", model: "User")', $allPermission);

            $paginatePermission = sprintf('paginate%1$s', str_plural($typeName));
            $paginatedQuery .= sprintf(' @can(if: "%1$s", model: "User")', $paginatePermission);

            GraphQLSchema::register($allQueryName, $typeName, 'query', $allPermission ?? null);
            GraphQLSchema::register($paginatedQueryName, $typeName, 'query', $paginatePermission ?? null);
        }


        return $allQuery ."\r\n". $paginatedQuery;
    }
1200228
public function getField(string $className): array
    {
        $conditionFieldsType = $this->types->getFilterGroupCondition($className);

        $field = [
            'name' => 'conditions',
            'description' => 'Conditions to be applied on fields',
            'type' => Type::listOf(Type::nonNull($conditionFieldsType)),
        ];

        return $field;
    }
481604
private function getGroupType(string $className, string $typeName): InputObjectType
    {
        $fields = [
            [
                'name' => 'groupLogic',
                'type' => $this->types->get('LogicalOperator'),
                'description' => 'The logic operator to be used to append this group',
                'defaultValue' => 'AND',
            ],
            [
                'name' => 'conditionsLogic',
                'type' => $this->types->get('LogicalOperator'),
                'description' => 'The logic operator to be used within all conditions in this group',
                'defaultValue' => 'AND',
            ],
            $this->filterGroupConditionTypeFactory->getField($className),
        ];

        // Only create join type, if there is anything to join on
        if ($this->filterGroupJoinTypeFactory->canCreate($className)) {
            $fields[] = $this->filterGroupJoinTypeFactory->getField($className);
        }

        $conditionType = new InputObjectType([
            'name' => $typeName . 'Group',
            'description' => 'Specify a set of joins and conditions to filter `' . Utils::getTypeName($className) . '`',
            'fields' => $fields,
        ]);
        $this->types->registerInstance($conditionType);

        return $conditionType;
    }
721949
public static function generate(array $typeFields): array
    {
        $arguments = [];
        foreach ($typeFields as $fieldName => $field) {
            $className = get_class($field);
            if (! in_array($className, self::$supportedGraphQLTypes) || in_array($fieldName, self::$ignoredColumns)) {
                continue;
            };

            $required = isset($field->config['generator-required']) && $field->config['generator-required'] === true ? '!' : '';
            $arguments[] = sprintf('%s: %s%s', $fieldName, $field->name, $required);
        }

        return $arguments;
    }
458087
private function _getFieldOptionsForConfigurator(): array
    {
        $fieldTypes = [];

        // Set a temporary namespace for these
        $originalNamespace = Craft::$app->getView()->getNamespace();
        $namespace = Craft::$app->getView()->namespaceInputName('blockTypes[__BLOCK_TYPE_NESTED__][fields][__FIELD_NESTED__][typesettings]', $originalNamespace);
        Craft::$app->getView()->setNamespace($namespace);

        foreach (Craft::$app->getFields()->getAllFieldTypes() as $class) {
            /** @var Field|string $class */
            // No Matrix-Inception, sorry buddy.
            if ($class === 'craft\fields\Matrix' || $class === 'verbb\supertable\fields\SuperTableField') {
                continue;
            }

            Craft::$app->getView()->startJsBuffer();
            /** @var FieldInterface $field */
            $field = new $class();
            $settingsBodyHtml = Craft::$app->getView()->namespaceInputs((string)$field->getSettingsHtml());
            $settingsFootHtml = Craft::$app->getView()->clearJsBuffer();

            $fieldTypes[] = [
                'type' => $class,
                'name' => $class::displayName(),
                'settingsBodyHtml' => $settingsBodyHtml,
                'settingsFootHtml' => $settingsFootHtml,
            ];
        }

        // Sort them by name
        ArrayHelper::multisort($fieldTypes, 'name');

        Craft::$app->getView()->setNamespace($originalNamespace);

        return $fieldTypes;
    }
752188
public static function getConfigList(string $entityName, string $objectName): array
    {
        $configs = [];

        $subdir = self::getConfigTypeDir($objectName);
        $path = CONFIG . 'Modules' . DS . $entityName . DS . 'config' . DS . $subdir;

        $files = self::getModuleFiles($path);
        $list = self::getModuleConfigNames($entityName, $files, $path);

        foreach ($list as $file => $caption) {
            $configs[$caption] = $caption;
        }

        return $configs;
    }
26705
public static function get_available_field_types() {
        $fieldtypes = array();

        $plugins = \core\plugininfo\customfield::get_enabled_plugins();
        foreach ($plugins as $type => $unused) {
            $fieldtypes[$type] = get_string('pluginname', 'customfield_' . $type);
        }
        asort($fieldtypes);

        return $fieldtypes;
    }
305605
public function & GetFieldsByType ($fieldType = '') {
		$result = [];
		foreach ($this->fields as & $field) {
			if ($field->GetType() == $fieldType)
				$result[$field->GetName()] = $field;
		}
		return $result;
	}
227469
public function getFields($type)
    {
        if (!array_key_exists($type, $this->_fields)) {
            $fields = [];
            if ($this->config->hasPointer($type)) {
                foreach ($this->config->getPointer($type) as $item) {
                    $fields[] = $item['name'];
                }
            }
            $this->_fields[$type] = $fields;
        }

        return $this->_fields[$type];
    }
1143888
public function buildTypoScriptRenderingConfiguration(string $extensionName, string $pluginName, string $contextRecordId): array
    {
        $configurationBuilder = new RecordRenderingConfigurationBuilder(new RenderingContext($GLOBALS['TSFE']));

        return $configurationBuilder->configurationFor($extensionName, $pluginName, $contextRecordId);
    }
530686
private function getCommonType($columnName, $field)
    {
        static $types = [
            SQLITE3_INTEGER => CommonTypes::TINT,
            SQLITE3_FLOAT => CommonTypes::TNUMBER,
            SQLITE3_TEXT => CommonTypes::TTEXT,
            // static::SQLITE3_BLOB => CommonTypes::TTEXT,
            // static::SQLITE3_NULL => CommonTypes::TTEXT,
        ];
        if (isset($this->overrideTypes[$columnName])) {
            return $this->overrideTypes[$columnName];
        }
        if (false !== $field && array_key_exists($field, $types)) {
            return $types[$field];
        }
        return CommonTypes::TTEXT;
    }
734687
protected function getFieldOptions(FieldTypeInterface $contentTypeField)
    {
        $contentTypeOptions = $contentTypeField->getFormOptions();
        $options = array();
        $field = $this->fieldTypesConfiguration[$contentTypeField->getType()];
        if (isset($field['options'])) {
            $configuratedOptions = $field['options'];
            foreach ($configuratedOptions as $optionName => $optionConfiguration) {
                $options[$optionName] = (isset($contentTypeOptions[$optionName])) ? $contentTypeOptions[$optionName] : $optionConfiguration['default_value'];
            }
        }
        return $options;
    }
46903
protected function inferField($fieldName, $fieldTypesPopularity)
    {
        // the $fieldTypesPopularity array is already sorted with most popular fields first
        $inferredField = null;
        foreach (array_keys($fieldTypesPopularity) as $inferredFieldType) {
            /** @var BaseField $inferredField */
            $inferredField = $this->fieldsPopularityObjects[$fieldName][$inferredFieldType];
            try {
                $rowNum = 0;
                foreach ($this->inputRows as $inputRow) {
                    if (!array_key_exists($rowNum, $this->castRows)) {
                        $this->castRows[$rowNum] = [];
                    }
                    $this->castRows[$rowNum][$fieldName] = $inferredField->castValue($inputRow[$fieldName]);
                    ++$rowNum;
                }
                break;
            } catch (FieldValidationException $e) {
                // a row failed validation for this field type, will continue to the next one according to popularity
                continue;
            }
        }

        return $inferredField;
    }