Method getFieldDefinitionsRecursive

@param DefinitionElementInterface $field
@return Schema\Field[]
166618
private function processFieldDefinitionsRecursive(DefinitionElementInterface $field)
    {
        if ($field instanceof JsonDefinitionField) {
            return [$this->cloneFieldDefinition($field->getDef())];
        } elseif ($field instanceof JsonDefinitionArray) {
            return $this->processFieldDefinitionsRecursive($field->getElement());
        } elseif ($field instanceof JsonDefinitionHash) {
            return array_reduce(
                $field->fields,
                function (array $subfields, DefinitionElementInterface $subfield) {
                    return array_merge($subfields, $this->processFieldDefinitionsRecursive($subfield));
                },
                $field->definition === null ? [] : [$this->cloneFieldDefinition($field->definition)]
            );
        }

        throw new \InvalidArgumentException(sprintf('Unknown field type "%s"', get_class($field)));
    }
1239546
protected function getFieldOptionsArray(FieldInterface $field)
    {
        $choices = [];
        $fieldOptions = $this->getFieldOptions($field);
        if (isset($fieldOptions['choices']) && is_array($fieldOptions['choices'])) {
            $choices = $fieldOptions['choices'];
        }
        return $choices;
    }
120991
private function prepareTypeDefinition(ScalarField $field)
    {
        if ($field instanceof IntegerField) {
            switch ($field->getSize()) {
                case FieldInterface::SIZE_TINY:
                    $result = 'TINYINT';
                    break;
                case ScalarField::SIZE_SMALL:
                    $result = 'SMALLINT';
                    break;
                case FieldInterface::SIZE_MEDIUM:
                    $result = 'MEDIUMINT';
                    break;
                case FieldInterface::SIZE_BIG:
                    $result = 'BIGINT';
                    break;
                default:
                    $result = 'INT';
            }

            if ($field->isUnsigned()) {
                $result .= ' UNSIGNED';
            }

            if ($field->getName() == 'id') {
                $result .= ' AUTO_INCREMENT';
            }

            return $result;
        } elseif ($field instanceof BooleanField) {
            return 'TINYINT(1) UNSIGNED';
        } elseif ($field instanceof DateField) {
            return 'DATE';
        } elseif ($field instanceof DateTimeField) {
            return 'DATETIME';
        } elseif ($field instanceof DecimalField) {
            $result = 'DECIMAL(' . $field->getLength() . ', ' . $field->getScale() . ')';

            if ($field->isUnsigned()) {
                $result .= ' UNSIGNED';
            }

            return $result;
        } elseif ($field instanceof EnumField) {
            return 'ENUM(' . implode(',', array_map(function ($possibility) {
                return $this->getConnection()->escapeValue($possibility);
            }, $field->getPossibilities())) . ')';
        } elseif ($field instanceof FloatField) {
            $result = 'FLOAT(' . $field->getLength() . ', ' . $field->getScale() . ')';

            if ($field->isUnsigned()) {
                $result .= ' UNSIGNED';
            }

            return $result;
        } elseif ($field instanceof JsonField) {
            return 'JSON';
        } elseif ($field instanceof StringField) {
            return 'VARCHAR(' . $field->getLength() . ')';
        } elseif ($field instanceof TextField) {
            switch ($field->getSize()) {
                case FieldInterface::SIZE_TINY:
                    return 'TINYTEXT';
                case ScalarField::SIZE_SMALL:
                    return 'TEXT';
                case FieldInterface::SIZE_MEDIUM:
                    return 'MEDIUMTEXT';
                default:
                    return 'LONGTEXT';
            }
        } elseif ($field instanceof TimeField) {
            return 'TIME';
        } else {
            throw new InvalidArgumentException('Field ' . get_class($field) . ' is not a support scalar field');
        }
    }
1249067
public function getIndexData(Field $field, FieldDefinition $fieldDefinition)
    {
        return array(
            new Search\Field(
                'value_address',
                $field->value->externalData['address'],
                new Search\FieldType\StringField()
            ),
            new Search\Field(
                'value_location',
                array(
                    'latitude' => $field->value->externalData['latitude'],
                    'longitude' => $field->value->externalData['longitude'],
                ),
                new Search\FieldType\GeoLocationField()
            ),
            new Search\Field(
                'fulltext',
                $field->value->externalData['address'],
                new Search\FieldType\FullTextField()
            ),
        );
    }
1168432
protected function _getFieldsFor(FieldListAwareInterface $object)
    {
        if (is_null($object->getFields())) {
            return false;
        }
        if (is_string($object->getFields())) {
            return $object->getFields();
        }
        $alias = (is_null($object->getAlias())) ?
            $object->getTable() : $object->getAlias();
        $fields = [];
        foreach ($object->getFields() as $field) {
            $fields[] = "{$alias}.{$field}";
        }

        return implode(', ', $fields);
    }
1056650
private function getFieldCopyToProperties(FieldInterface $field)
    {
        $copyTo = [];

        foreach ($this->copyFieldMap as $method => $targetField) {
            if ($field->$method()) {
                $copyTo[] = $targetField;
            }
        }

        return $copyTo;
    }
198485
public function map($field, $context = null)
    {
        if ($context instanceof JsonDefinition &&
            $context->getField($field['fieldName']) instanceof DefinitionElementInterface
        ) {
            $fieldInformation = $context->getField($field['fieldName'])
                ->getDefAsArray();

            // in this context, the default type is the doctrine type..
            if (isset($fieldInformation['doctrineType'])) {
                $fieldInformation['type'] = $fieldInformation['doctrineType'];
            }

            $field = array_merge($field, $fieldInformation);
        }

        return $field;
    }
494581
private function getDefinedTypesFromSchema(Schema $schema, array $definitionFileDirectories): array
    {
        $definedTypes = $this->definitionsParser->getGraphqlDefinitionFilePaths(
            $definitionFileDirectories['types']
        );

        foreach ($definedTypes as $key => $type) {
            $definedTypes[$key] = str_replace('.graphql', '', basename($type));
        }

        $internalTypes = [];
        /**
         * @var string $typeName
         * @var ObjectType $type
         */
        foreach ($schema->getTypeMap() as $typeName => $type) {
            if (! in_array($typeName, $definedTypes) || ! method_exists($type, 'getFields')) {
                continue;
            }

            /**
             * @var string $fieldName
             * @var FieldDefinition $fieldType
             */
            foreach ($type->getFields() as $fieldName => $fieldType) {
                $graphQLType = $fieldType->getType();

                //Every required field is defined by a parent 'NonNullType'
                if (method_exists($graphQLType, 'getWrappedType')) {
                    // Clone the field to prevent pass by reference,
                    // because we want to add a config value unique to this field.
                    $graphQLType = clone $graphQLType->getWrappedType();

                    //We want to know later on wether or not a field is required
                    $graphQLType->config['generator-required'] = true;
                }

                if (! in_array(get_class($graphQLType), $this->supportedGraphQLTypes)) {
                    continue;
                };

                // This retrieves the GraphQL type for this field from the webonyx/graphql-php package
                $internalTypes[$typeName][$fieldName] = $graphQLType;
            }
        }

        return $internalTypes;
    }
687452
private function cloneFieldDefinition(Schema\Field $field)
    {
        $clone = clone $field;
        $clone->setName(preg_replace('/^'.preg_quote($this->name, '/').'\.(\d+\.)*/', '', $clone->getName()));
        return $clone;
    }
912750
private function getFields($field)
    {
        if ($field instanceof Group || $field instanceof Fieldset) {
            $elements = $field->getFields();
        } elseif ($field instanceof AbstractField) {
            $elements = [$field];
        } else {
            throw new \InvalidArgumentException(sprintf(
                "Invalid type '%s'",
                is_object($field) ? get_class($field) : gettype($field)
            ));
        }

        return $elements;
    }
422507
public function getIndexData(Field $field, FieldDefinition $fieldDefinition)
    {
        return array(
            new Search\Field(
                'value',
                reset($field->value->data),
                new Search\FieldType\StringField()
            ),
        );
    }
556301
private function getFieldLayoutFieldsDefinition(array $fields): array
    {
        $fieldDefinitions = [];

        foreach ($fields as $field) {
            $fieldDefinitions[$field->handle] = $field->required;
        }

        return $fieldDefinitions;
    }
419354
public function getField(string $name): FieldInterface
    {
        if (!$this->hasField($name)) {
            throw new DefinitionException("Field '$name' is not defined.");
        }

        return $this->fields[$name];
    }
1211588
private function get_field_definition( $type, $options = null ) {

		$definition = PodsForm::field_method( $type, 'schema', $options );

		return $this->do_hook( 'field_definition', $definition, $type, $options );
	}
477103
public function getDefaultFormFieldValueOptions(FieldInterface $field)
    {
        $defaultOptions = ['label' => false];
        if ($field->getHint()) {
            $defaultOptions['attr']['help'] = $field->getHint();
        }
        return $defaultOptions;
    }
225002
public function getDerivedFields()
    {
        if ($this->derivedFields === null) {
            $this->derivedFields = array();

            foreach ($this->getFieldsIterator() as $name => $field) {
                if (count($field['lookup_chain']) < 2) {
                    continue;
                }

                $key = sha1($field['base'] . serialize($field['lookup_chain']));
                $fieldname = "{$field['class']}:{$field['field']}";

                if (isset($this->derivedFields[$key])) {
                    $this->derivedFields[$key]['fields'][$fieldname] = $fieldname;
                    SearchIntrospection::add_unique_by_ancestor($this->derivedFields['classes'], $field['class']);
                } else {
                    $chain = array_reverse($field['lookup_chain']);
                    array_shift($chain);

                    $this->derivedFields[$key] = array(
                        'base' => $field['base'],
                        'fields' => array($fieldname => $fieldname),
                        'classes' => array($field['class']),
                        'chain' => $chain
                    );
                }
            }
        }

        return $this->derivedFields;
    }
685222
public function getIndexData(Field $field, FieldDefinition $fieldDefinition)
    {
        return array(
            new Search\Field(
                'file_name',
                $field->value->externalData['fileName'],
                new Search\FieldType\StringField()
            ),
            new Search\Field(
                'file_size',
                $field->value->externalData['fileSize'],
                new Search\FieldType\IntegerField()
            ),
            new Search\Field(
                'mime_type',
                $field->value->externalData['mimeType'],
                new Search\FieldType\StringField()
            ),
        );
    }