@param string $fieldName
@param $values

@return array|Attribute[]
322128
protected function getAttributesByFieldNameAndValues(string $fieldName, $values)
    {
        $attributes = [];

        if (empty($values) || empty($this->attributes)) {
            return $attributes;
        }

        foreach ($this->attributes as $attribute) {
            if (in_array($attribute->{$fieldName}, $values)) {
                $attributes[] = $attribute;
            }
        }

        return $attributes;
    }
805565
public static function getField($arrayList, $fieldName = 'id'): array
    {
        $result = [];

        if (!empty($arrayList) && is_array($arrayList)) {
            foreach ($arrayList as $option) {
                if (is_array($option)) {
                    $result[] = $option[$fieldName];
                } elseif (is_object($option)) {
                    if (isset($option->{$fieldName})) {
                        $result[] = $option->{$fieldName};
                    }
                }
            }
        }

        return $result;
    }
700657
public function getErrors($fieldName=null)
    {
        if ($fieldName === null) {
            return $this->errors;
        }

        if (isset($this->errors[$fieldName])) {
            return $this->errors[$fieldName];
        }

        return [];
    }
895095
public function getField($fieldName) {
        if(empty($fieldName)) {
            throw new \InvalidArgumentException('Please provide a fieldname');
        }
        
        $values = array();
        foreach($this->fields as $field) {
            if($field['name'] == $fieldName) {
                $values[] = $field['value'];
            }
        }
        
        return $values;
    }
196908
public function findFieldInArray($fieldname) {
        foreach ($this->fields as $i => $field) {
            if ($fieldname == $field->getName()) {
                return $i;
            }
        }
        return null;
    }
64083
protected function createArray(string $fieldName, array $aggregation): array
    {
        $return = [];
        $buckets = $aggregation['buckets'] ?? $aggregation[$fieldName]['buckets'] ?? null;
        if (!$buckets) {
            return $return;
        }
        $attributeId = $this->isAttribute($fieldName);
        foreach ($buckets as $key => $bucket) {
            $return[$key]['count'] = $bucket['doc_count'];
            $return[$key][($attributeId === false ? $fieldName : 'attributeValueId')] = $bucket['key'];
            if ($attributeId !== false) {
                $return[$key]['attributeId'] = $attributeId;
            }
        }

        return array_values($return);
    }
1136612
public function getModelDefinitionByFieldName($fieldName)
    {
        foreach ($this->fieldMappings as $mapping) {
            if (in_array($fieldName, $mapping->getFields())) {
                return $mapping;
            }
        }

        throw new \InvalidArgumentException(sprintf('%s does not exists in %s', $fieldName, $this->name));
    }
295023
public function getOperationValue($fieldName)
    {
        $sql = sprintf(
            '%s %s %s',
            $fieldName,
            $this->strFilterToDbNotation(),
            $this->columnToCompare
        );

        return [
            $sql,
            [],
        ];
    }
532955
protected static function setFieldPluginAndModel(string $tableName, array $fields) : array
    {
        list($plugin, $model) = pluginSplit($tableName);

        $callback = function (&$value, $key) use ($plugin, $model) {
            $value = ['plugin' => $plugin, 'model' => $model, 'name' => $value];

            return $value;
        };

        array_walk_recursive($fields, $callback);

        return $fields;
    }
1072949
public function getAttributes($names = null)
    {
        $values = [];
        foreach ($this->attributeNames() as $name) {
            $values[$name] = $this->{$name};
        }

        if (is_array($names)) {
            $values2 = [];
            foreach ($names as $name) {
                $values2[$name] = isset($values[$name]) ? $values[$name] : null;
            }
            return $values2;
        }
        return $values;
    }
123320
public function getFieldValues(array $data) : array
    {
        $result = [];
        foreach ($this->getFields() as $field) {
            $result[$field] = array_key_exists($field, $data) ? $data[$field] : null;
        }

        return $result;
    }
710311
private function getFieldInfo($key, $value): array
    {
        $name = null;
        $options = [];
        if (is_numeric($key) && is_string($value)) {
            $name = $value;
        } else if (is_numeric($key) && is_array($value)) {
            $name = array_shift($value);
            $options = $value;
        } else if (is_string($key)) {
            $name = $key;
            $options = $value;
        }
        return ['name' => $name, 'options' => $options];
    }
1208552
public function getValues(array $attribute_names = [])
    {
        $values = [];
        if (!empty($attribute_names)) {
            foreach ($attribute_names as $attribute_name) {
                $values[$attribute_name] = $this->getValue($attribute_name);
            }
        } else {
            foreach ($this->getType()->getAttributes() as $attribute) {
                $values[$attribute->getName()] = $this->getValue($attribute->getName());
            }
        }

        return $values;
    }
945367
private function fieldList($key, $value, array $fields)
    {
        return [
            'type'   => $fields[$key]['type'],
            'before' => ['render' => Json::parse($value[0])],
            'after'  => ['render' => Json::parse($value[1])],
        ];
    }
1214381
protected function getValues(array $values)
    {
        $array = [];

        $versionedKeys = array_merge(
            $this->model->getVersionedAttributeNames(),
            [$this->model->getLatestVersionColumn(), $this->model->getVersionColumn(), $this->model->getVersionKeyName()]
        );

        foreach ($values as $key => $value) {
            if (! $this->isVersionedKey($key, $versionedKeys)) {
                $array[$key] = $value;
            }
        }

        return $array;
    }
281159
public function & GetField ($fieldName = '') {
		$result = NULL;
		if (isset($this->fields[$fieldName]))
			$result = & $this->fields[$fieldName];
		return $result;
	}
968387
protected function arrayToHtmlAttributes(array $values)
    {
        $output = "";
        ksort($values);

        foreach ($values as $key => $value) {
            $output .=  sprintf('%s="%s" ', htmlentities($key), htmlentities($value));
        }

        return $output;
    }