getFieldType

Return the type associated with the given field.

@access public
@param  string $name
@throws ModelException if $name is null or field does not exist
@return string null if type is not set
11956
public function getFieldType($name)
    {
        return $this->checkFieldExist($name)->types[$name] != null
            ? rtrim($this->types[$name], '[]')
            : null;
    }
1045910
public function getFieldByName(string $name)
    {
        $found = array_filter($this->fields, function ($field) use ($name) {
            /** @var FieldTypeInterface $field */
            return $name === $field->getBaseName();
        });

        if (! empty($found)) {
            return array_pop($found);
        }

        throw new TaxonomyFieldNotFoundException("Taxonomy field with a name of {$name} not found.");
    }
69940
protected function _checkFieldType($modelFieldName = null) {
		if (empty($modelFieldName) || !is_string($modelFieldName)) {
			return false;
		}

		if (strpos($modelFieldName, '.') === false) {
			return false;
		}

		list($modelName, $fieldName) = pluginSplit($modelFieldName);
		$schema = $this->_getSchemaForModel($modelName);
		if (($schema === null) || !is_array($schema) || !isset($schema[$fieldName]['type']) ||
			!in_array($schema[$fieldName]['type'], ['text', 'string'])) {
			return false;
		}

		return true;
	}
1295803
public function getFieldValue($name)
    {
        $value = null;
        $field = $this->getField($name);
        if (null !== $this->getField($name)) {
            $value = (array_key_exists('value', $field) && null !== $field['value']) ? $field['value'] : null;
        }
        return $value;
    }
46159
public static function getTypeByName($name)
    {
        /** @noinspection PhpUndefinedMethodInspection */
        $typeRec = static::whereName($name)->get(['type'])->first();

        return (isset($typeRec, $typeRec['type'])) ? $typeRec['type'] : null;
    }
846007
public function field($name)
    {
        foreach($this->data as $post)
        {
            $fieldType = get_field_object($name, $post->ID)['type'];

            if(in_array($fieldType, ['text']))
            {
                $post->$name = get_field($name, $post->ID);
            }
            elseif(in_array($fieldType, ['image']))
            {
                $post->$name = Data::arrayToObject(get_field($name, $post->ID));
            }
        }

        return $this->data;
    }
447379
public function getOption($name)
    {
        if (!$this->hasOption($name)) {
            throw new FieldException(sprintf('There\'s no option named "%s"', is_scalar($name) ? $name : gettype($name)));
        }
        return $this->options[$name];
    }
288881
public function getResourceType($name)
    {
        if (isset($this->types[$name])) {
            return $this->types[$name];
        }

        return null;
    }
1100484
public function getFieldValue($name)
    {
        $fieldValues = $this->toArray();
        return (isset($fieldValues[$name])) ? $fieldValues[$name] : null;
    }
121010
public function getField($name)
    {
        if ($this->has($name)) {
            return $this->fields[$name];
        }

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

        return $this->fields[$name];
    }
1053289
public function getField($name)
    {
        return $this->fields->has($name) ? $this->fields[$name] : null;
    }
778897
public function getMethod($name)
    {
        if ($this->hasMethod($name)) {
            return $this->methods[$name];
        }
        throw new ModelException(
            'Method ' . $name . ' does not exist.'
        );
    }
1107091
public function getField($name)
    {
        $f = $this->hasField($name);

        if ($f === false) {
            throw new Exception(['Field is not defined in model', 'model' => get_class($this), 'field' => $name]);
        }

        return $f;
    }
1267304
public function getField($name)
    {
        return (isset($this->fields[$name])) ? $this->fields[$name] : false;
    }
1352177
public function getTypeOfField($fieldName)
    {
        if (!isset($this->fieldMappings[$fieldName])) {
            throw MappingException::mappingNotFound($this->name, $fieldName);
        }

        return isset($this->fieldMappings[$fieldName]) ?
                $this->fieldMappings[$fieldName]['type'] : null;
    }
259465
public function getFieldByName($name)
    {
        if (!isset($this->_fieldNameMap[$name])) {
            $message = 'Field name "' . $name . '" not associated to this schema.';
            throw new \InvalidArgumentException($message);
        }
        return $this->getField($this->_fieldNameMap[$name]);
    }