Override a Field Definition

@param ArrayObject $field  Original Field Definition
@param Array       $values Custom Values to Write

@return ArrayObject
324085
private static function updateField($field, $values)
    {
        Splash::log()->trace();
        //====================================================================//
        // Check New Configuration is an Array
        if (!is_array($values)) {
            return $field;
        }

        //====================================================================//
        // Field Type
        self::updateFieldStrVal($field, $values, "type");
        // Field Name
        self::updateFieldStrVal($field, $values, "name");
        // Field Description
        self::updateFieldStrVal($field, $values, "desc");
        // Field Group
        self::updateFieldStrVal($field, $values, "group");
        // Field MetaData
        self::updateFieldMeta($field, $values);

        //====================================================================//
        // Field Favorite Sync Mode
        self::updateFieldStrVal($field, $values, "syncmode");
        //====================================================================//
        // Field is Required Flag
        self::updateFieldBoolVal($field, $values, "required");
        //====================================================================//
        // Field Read Allowed
        self::updateFieldBoolVal($field, $values, "read");
        //====================================================================//
        // Field Write Allowed
        self::updateFieldBoolVal($field, $values, "write");
        //====================================================================//
        // Field is Listed Flag
        self::updateFieldBoolVal($field, $values, "inlist");
        //====================================================================//
        // Field is Logged Flag
        self::updateFieldBoolVal($field, $values, "log");

        return $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;
    }
108689
public function fields(array $fields)
    {
        foreach ($fields as $field => &$value) {
            $value = $value ? 1 : -1;
        }

        $this->fields = array_merge($this->fields, $fields);

        return $this;
    }
1060609
public function addAllToSet(string $field, array $values)
    {
        $this->update()->addToSet($field, ['$each' => $values]);

        return $this;
    }
1209084
public function setFieldValue($object, $field, $value)
    {
        $this->assertObjectInstance($object);

        return $this->getField($field)->set($object, $value);
    }
660424
public function addTranslatableField(array $field)
	{
		$currFields = $this->getTranslatableFields();

		$this->setTranslatableFields(array_merge($currFields, $field));
	
		return $this;
	}
536890
public function setFieldsWithValues(array $fieldsValues)
    {
        $this->supports = [];
        $this->values = [];

        foreach ($fieldsValues as $field => $value) {
            if (is_int($field)) {
                $field = $value;
                $value = null;
            }

            $this->supports[ ] = $field;
            if (!is_null($value)) {
                $this->values[ $field ] = $value;
            }
        }

        return $this;
    }
1191986
private function createFieldDefinition(FieldDefinitionObject $field)
    {
        $definition = $this->contentTypeService->newFieldDefinitionCreateStruct($field->data['identifier'], $field->data['type']);
        $field->getMapper()->mapObjectToCreateStruct($definition);

        return $definition;
    }
460857
public function addExclude($field, $values)
    {
        $excludes = isset($this->exclude[$field]) ? $this->exclude[$field] : [];
        $values = is_array($values) ? $values : [$values];
        $this->exclude[$field] = array_merge($excludes, $values);
        return $this;
    }
1024287
public function setFields($fields = [])
    {
        $existingSchema = $this->get();

        $request = [];
        foreach ($fields as $field) {
            $mode = $this->hasField($field['name'], $existingSchema) ? 'replace-field' : 'add-field';
            $request[$mode][] = $field;
        }

        return $this->request($request);
    }
211985
public function fields(array $fields = [])
    {
        if (!Arr::isAssoc($fields)) {
            $fields = array_combine($fields, $fields);
        }

        foreach ($fields as $field => $label) {
            $this->field($field, $label);
        }

        return $this;
    }
8095
protected function buildIn($field, array $values, $isIn)
    {
        $operator = $isIn ? ' IN ' : ' NOT IN ';

        return $field.$operator.$this->parameterizeValues($values);
    }
1208520
public function addCustomMultiField($id, $values)
    {
        $field = [
            'id' => $id,
            'values' => [],
        ];

        if (!is_array($values)) {
            $values = [$values];
        }

        $field['values'] = $values;

        $this->values['custom_fields'][] = $field;

        return $this;
    }
389278
public function addFields(array $fields)
    {
        foreach ($fields as $field) {
            if (!$field instanceof FieldDefinitionInterface) {
                continue;
            }

            $this->addField($field);
        }

        return $this;
    }
346017
public function fieldValue($field, $value)
    {
        if (!in_array($field, $this->supports)) {
            $this->supports[ ] = $field;
        }
        $this->values[ $field ] = $value;

        return $this;
    }
406814
public function setMultiFields(array $fields = [])
    {
        if (empty($fields)) {
            unset($this->query['multi-fields']);
        } else {
            $this->query['multi-fields'] = $fields;
        }
        return $this;
    }
1181256
private function _setFields($object, $fields)
    {
        $fields = is_array($fields) ? $fields : [];
        foreach ($fields as $sKey => $sValue) {
            $object->$sKey = oxNew('oxField', $sValue);
        }

        return $object;
    }