src/Models/FieldEditor/ObjectSection.php
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");
    }
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");
    }
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" ) ; }
Given an ObjectField, find a matching one in this section to update

@param ObjectField $field

@throws FieldEditorException
Given an ObjectField find a matching one in this section to update