Given an ObjectField, find a matching one in this section to update

@param ObjectField $field

@throws FieldEditorException
487625
public function updateField($field)
    {
        if (!$field instanceof ObjectField)
        {
            throw new FieldEditorException(print_r($field, true) . " is not of type ObjectField");
        }
        foreach ($this->_fields as $column => $fields)
        {
            foreach ($fields as $index => $f)
            {
                $existing_field = $f->getField();
                if ($existing_field !== null && $field->getField() === $existing_field)
                {
                    // If the field name (f1234) exists merge replace on that.
                    $this->_fields[$column][$index] = $field;
                    return;
                }
            }
        }
        throw new FieldEditorException("Could not find an existing field: {$field->getField()} in this Section");
    }
1161824
private function completeField(Field $field, ReflectionMethod $method): void
    {
        $fieldName = lcfirst(preg_replace('~^get~', '', $method->getName()));
        if (!$field->name) {
            $field->name = $fieldName;
        }

        $docBlock = new DocBlockReader($method);
        if (!$field->description) {
            $field->description = $docBlock->getMethodDescription();
        }

        $this->completeFieldArguments($field, $method, $docBlock);
        $this->completeFieldType($field, $method, $fieldName, $docBlock);
    }
253693
protected function updateField(Field $field, Content $content)
    {
        $this->contentGateway->updateField(
            $field,
            $this->mapper->convertToStorageValue($field)
        );

        // If the storage handler returns true, it means that $field value has been modified
        // So we need to update it in order to store those modifications
        // Field converter is called once again via the Mapper
        if ($this->storageHandler->storeFieldData($content->versionInfo, $field) === true) {
            $this->contentGateway->updateField(
                $field,
                $this->mapper->convertToStorageValue($field)
            );
        }
    }
953205
public function setField(AbstractFormField $field)
    {
        if (!($field instanceof SelectField)) {
            throw new \Exception('The validator "' . get_class($this) . '" only works on select fields!');
        }

        $this->field = $field;
    }
604430
private function completeFieldType(Input $field, ReflectionMethod $method, ReflectionParameter $param, DocBlockReader $docBlock): void
    {
        // If still no type, look for docBlock
        if (!$field->getTypeInstance()) {
            $typeDeclaration = $docBlock->getParameterType($param);
            $this->throwIfArray($param, $typeDeclaration);
            $field->setTypeInstance($this->getTypeFromPhpDeclaration($method, $typeDeclaration, true));
        }

        // If still no type, look for type hint
        $type = $param->getType();
        if (!$field->getTypeInstance() && $type) {
            $this->throwIfArray($param, (string) $type);
            $field->setTypeInstance($this->reflectionTypeToType($type, true));
        }

        $this->nonNullIfHasDefault($field);

        // If still no type, cannot continue
        $this->throwIfNotInputType($param, $field);
    }
615438
public function overrideFields($objectType, $fields)
    {
        Splash::log()->trace();
        //====================================================================//
        // Check if Configuration is Empty
        if (empty($this->getConfiguration())) {
            return $fields;
        }
        //====================================================================//
        // Load Configuration from Configurator
        $overrides = $this->getConfigurationValue($objectType, "fields");
        //====================================================================//
        // Check if Configuration is an Array
        if (!is_array($overrides)) {
            return $fields;
        }
        //====================================================================//
        // Walk on Defined Fields
        foreach ($fields as $index => $field) {
            //====================================================================//
            // Check if Configuration Key Exists
            if (!isset($overrides[$field->id])) {
                continue;
            }
            //====================================================================//
            // Update Field Definition
            $fields[$index] = self::updateField($field, $overrides[$field->id]);
        }

        return $fields;
    }
1237867
protected function setSubmittedList($field)
    {
        $value = $this->getSubmitted($field);

        if (isset($value)) {
            $this->setSubmitted($field, $this->explodeList($value));
        }
    }
624703
public function addField(Field $field)
    {
        $this->fields->set($field->getColumn(), $field);
        
        return $this;
    }
992207
public function setField(AbstractFormField $field)
    {
        if (!($field instanceof RadioButton)) {
            throw new \Exception('The validator "' . get_class($this) . '" only works on radio buttons!');
        }

        $this->field = $field;
    }
1029773
protected function assignField(FieldInterface $field)
    {
        if ($field->mapping() !== null) {
            $this->builder->addSelect(
                sprintf(
                    '%s AS %s',
                    $this->connection->quoteIdentifier($field->mapping()),
                    $this->connection->quoteIdentifier($field->name())
                )
            );
        } else {
            $this->builder->addSelect($this->connection->quoteIdentifier($field->name()));
        }

        $this->casts[$field->name()] = $field->type();
    }
281470
public function updateField(Field $field, StorageFieldValue $value)
    {
        try {
            return $this->innerGateway->updateField($field, $value);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
100809
protected function initializeField($field)
    {
        $field->setParentContext($this);
        $this->getFieldManager()->pushField($field);
        return $field;
    }
847249
protected function submitEditField()
    {
        if ($this->isPosted('delete')) {
            $this->deleteField();
        } else if ($this->isPosted('save') && $this->validateEditField()) {
            if (isset($this->data_field['field_id'])) {
                $this->updateField();
            } else {
                $this->addField();
            }
        }
    }
617548
public function onPostSerialize(ObjectEvent $event)
    {
        $customUrl = $event->getObject();
        $visitor = $event->getVisitor();

        if (!$customUrl instanceof CustomUrlDocument) {
            return;
        }

        if (null !== $customUrl->getTargetDocument()) {
            $visitor->addData('targetTitle', $customUrl->getTargetDocument()->getTitle());
            $visitor->addData('targetDocument', $customUrl->getTargetDocument()->getUuid());
        }

        $visitor->addData(
            'customUrl',
            $this->generator->generate($customUrl->getBaseDomain(), $customUrl->getDomainParts())
        );

        $visitor->addData('creatorFullName', $this->userManager->getFullNameByUserId($customUrl->getCreator()));
        $visitor->addData('changerFullName', $this->userManager->getFullNameByUserId($customUrl->getChanger()));
    }
131123
public function setField(string $field) : void
    {
        $field = trim($field);
        if (empty($field)) {
            throw new InvalidArgumentException("Field is empty");
        }

        $this->field = $field;
    }
417647
public function set(string $field, $value): Update
    {
        $this->what[$field] = $value;
        return $this;
    }
1036608
public function updateCMSFields(FieldList $fields)
    {
        $owner = $this->owner;
        $fields->removeByName(array('MD5Email', 'NewsID'));
        $fields->addFieldsToTab(
            'Root.Main', array(
                TextField::create('Title', $owner->fieldLabel('Title')),
                TextField::create('Name', $owner->fieldLabel('Name')),
                TextField::create('Email', $owner->fieldLabel('Email')),
                TextField::create('URL', $owner->fieldLabel('URL')),
                HtmlEditorField::create('Comment', $owner->fieldLabel('Comment')),
                CheckboxField::create('AkismetMarked', $owner->fieldLabel('AkismetMarked')),
                CheckboxField::create('Visible', $owner->fieldLabel('Visible')),
                CheckboxField::create('ShowGravatar', $owner->fieldLabel('ShowGravatar')),
            )
        );
    }