Returns a named field.
You can use dot syntax to get fields from child composite fields

@todo Implement similarly to dataFieldByName() to support nested sets - or merge with dataFields()

@param string $name
@return FormField
7296
public function fieldByName($name)
    {
        if (strpos($name, '.') !== false) {
            list($name, $remainder) = explode('.', $name, 2);
        } else {
            $remainder = null;
        }

        foreach ($this as $child) {
            if (trim($name) == trim($child->getName()) || $name == $child->id) {
                if ($remainder) {
                    if ($child instanceof CompositeField) {
                        return $child->fieldByName($remainder);
                    } else {
                        $childClass = get_class($child);
                        user_error(
                            "Trying to get field '{$remainder}' from non-composite field {$childClass}.{$name}",
                            E_USER_WARNING
                        );
                        return null;
                    }
                } else {
                    return $child;
                }
            }
        }
        return null;
    }
325428
public function getFormName($name)
    {
        return isset($this->forms[$name]['name']) ? $this->forms[$name]['name'] : null;
    }
1100484
public function getFieldValue($name)
    {
        $fieldValues = $this->toArray();
        return (isset($fieldValues[$name])) ? $fieldValues[$name] : null;
    }
639487
protected function &findFieldsByFieldset($name)
	{
		// Initialise variables.
		$false = false;

		// Make sure there is a valid Form XML document.
		if (!($this->xml instanceof SimpleXMLElement))
		{
			return $false;
		}

		// Get an array of <field /> elements that are underneath a <fieldset /> element
		// with the appropriate name attribute, and also any <field /> elements with
		// the appropriate fieldset attribute.
		$fields = $this->xml->xpath('//fieldset[@name="' . $name . '"]//field | //field[@fieldset="' . $name . '"]');

		return $fields;
	}
781322
public function findField(string $name): Field
    {
        if ($this->hasField($name)) {
            return $this->fields[$this->fieldsNameIndex[$name]];
        }

        return null;
    }
1254701
public function getFieldsByName($name)
    {
        $result = [];

        foreach ($this->fields as $field) {
            if ($field->getName() == $name) {
                $result[] = $field;
            }
        }

        return $result;
    }
570603
protected function getFieldValue($name)
    {
        $field = $this->getField($name);

        if ($field->getSqlType()) {
            $platform = $this->getConnection()->getDatabasePlatform();

            $attributeValue = $this->getAttribute($field->getAttributeName());

            if ($name == $field->getAttributeName()) {
                return $field->convertToPHPValueSQL($attributeValue, $platform);
            }

            return $field->convertToPHPValue($attributeValue, $platform);
        }

        return $field->getValue();
    }
1001707
public function setName($name)
    {
        $this->name = $name;
        $this->setValue($this->form->getFieldValue($this->name));
        return $this;
    }
456734
public function getManyToManyField($name)
    {
        $field = $this->getField($name);

        return $field instanceof ManyToManyField ? $field : null;
    }
512451
public function dataFieldByName($name)
    {
        if ($dataFields = $this->dataFields()) {
            foreach ($dataFields as $child) {
                if (trim($name) == trim($child->getName()) || $name == $child->id) {
                    return $child;
                }
            }
        }
        return null;
    }
1260707
protected function formatInnerField($name = null, $inner = [])
    {
        if ($inner instanceof BaseField) {
            return $inner;
        }

        if ($inner instanceof self) {
            $formattedItems = [];

            foreach ($inner->toArray() as $name => $inner) {
                $formattedItems[$name] = $this->formatInnerField($inner);
            }

            return $formattedItems;
        }

        if (is_scalar($inner) && $this->fields->typeExists($inner)) {
            return $this->createField($inner, $name, $this->getValue($name), $inner);
        }

        if (is_array($inner) && array_key_exists('type', $inner) && is_scalar($inner['type']) && $this->fields->typeExists($inner['type'])) {
            $type = $inner['type'];
            array_forget($inner, 'type');

            return $this->createField($type, $name, $this->getValue($name), $inner);
        }

        if (is_array($inner)) {
            $formattedItems = [];

            foreach ($inner as $name => $inner) {
                $formattedItems[$name] = $this->formatInnerField($inner);
            }

            return $formattedItems;
        }
    }
1139390
protected function getModelValueAttribute($name)
    {
        $key = $this->transformKey($name);

        if (method_exists($this->model, 'getFormValue')) {
            return $this->model->getFormValue($key);
        }

        return data_get($this->model, $this->transformKey($name));
    }
265099
public function getField(string $name)
    {
        $name = trim($name);
        if (!$this->isFieldSet($name)) {
            return null;
        }

        $field_key = array_search($name, $this->keys);
        return $this->method[$field_key] ?? $_FILES[$field_key];
    }
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];
    }
1281353
public function getField(string $name): Field
    {
        if (!$this->hasField($name)) {
            throw new \OutOfBoundsException(sprintf('Field "%s" not found', $name));
        }

        return $this->fields[$name];
    }
364797
public function getField($name)
    {
        if (array_key_exists($name, $this->fields)) {
            return $this->fields[$name];
        }
        else if (array_key_exists($name, $this->fieldAliases)) {
            $name = $this->fieldAliases[$name];
            return $this->fields[$name];
        }
        return null;
    }
1140592
public function getRelationshipField($name)
    {
        $result = array_filter($this->getRelationshipFields(), function($field) use ($name) {
            return $name === $field->getName();
        });

        return reset($result);
    }