Get an associative array of other attributes for a field name.

@param string $field A dot separated path to get additional data on.
@return array An array of data describing the additional attributes on a field.
345253
public function attributes($field)
    {
        $parts = explode('.', $field);
        $table = $this->_getTable($parts);
        $column = (array)$table->getSchema()->getColumn(array_pop($parts));
        $whitelist = ['length' => null, 'precision' => null];

        return array_intersect_key($column, $whitelist);
    }
1030671
public function get($field) {

        if (isset($this->data[$field])) {
            return $this->data[$field];
        }

        // Fallback to extra data.
        if (isset($this->extradata[$field])) {
            return $this->extradata[$field];
        }

        throw new \coding_exception('Field "' . $field . '" is not set in the document');
    }
484303
public function attributes(FieldView $field)
    {
        if (is_null($field)) {
            return $this;
        }

        if (!is_null($field->label)) {
            $this->attributes['label'] = $field->label;
        }
        if (!is_null($field->description)) {
            $this->attributes['help'] = $field->description;
        }

        if (!is_null($field->placeholder)) {
            array_set($this->attributes, 'attributes.placeholder', $field->placeholder);
        }

        if (!empty($field->additional_attributes)) {
            $attrs                = explode(';', $field->additional_attributes);
            $additionalAttributes = [];
            array_map(function($element) use(&$additionalAttributes) {
                @list($name, $value) = explode(':', $element);
                $additionalAttributes[$name] = $value;
            }, $attrs);
            array_set($this->attributes, 'attributes', array_merge($this->attributes['attributes'], $additionalAttributes));
        }

        $this->id                 = $this->id ?? $field->name;
        $this->name               = $this->name ?? $field->name;
        $this->type               = $this->type ?? $field->type_name . (($field->type) ? ':' . $field->type : '');
        $this->value              = $this->value ?? $field->value;
        $this->attributes['name'] = $field->name;
        if ($field->option_values && !isset($this->attributes['options'])) {
            $options = explode(';', $field->option_values);
            foreach ($options as $option) {
                @list($value, $label) = explode(':', $option);
                $this->attributes['options'][$value] = $label;
            }
        }
        if (is_null($this->field)) {
            $this->field = $field;
        }

        $validatorOptions = explode(';', $field->validators_config);
        $options          = [];
        foreach ($validatorOptions as $option) {
            @list($id, $value) = explode(':', $option);
            array_set($options, $id, $value);
        }
        $validators = explode(';', $field->validators);
        $config     = [];
        foreach ($validators as $validator) {
            @list($id, $name) = explode(':', $validator);
            if ($name == 'custom') {
                continue;
            }
            if (isset($options[$id])) {
                $name = $name . ':' . $options[$id];
            }
            array_set($config, $id, $name);
        }

        if (!isset($this->rules[$this->name])) {
            $this->rules[$this->name] = [];
        }
        $this->rules[$this->name] = array_unique(array_merge($this->rules[$this->name], $config));

        return $this;
    }
1360261
private function parseField(string $field): array
    {
        $source = static::DEFAULT_SOURCE;
        $type = static::DEFAULT_TYPE;
        $origin = null;

        if (strpos($field, '(') !== false) {
            $source = substr($field, strpos($field, '(') + 1, -1);
            $field = substr($field, 0, strpos($field, '('));

            if (strpos($source, ':') !== false) {
                list($source, $origin) = explode(':', $source);
            }
        }

        if (strpos($field, ':') !== false) {
            list($field, $type) = explode(':', $field);
        }

        return [$field, $type, $source, $origin];
    }
325838
private function getScalarField($field)
	{
		$dataField = array_merge($this->defaultField, [
			'property' => $field->getName(),
			'title' => $field->getTitle(),
			'type' => get_class($field),
			'validators' => $field->getValidators(),
			'modifiers' => [
				'save' => $field->getSaveDataModifiers(),
				'fetch' => $field->getFetchDataModifiers(),
			],
		]);

		if($field instanceof Main\Entity\ScalarField){
			$dataField['primary'] = $field->isPrimary();
			$dataField['unique'] = $field->isUnique();
			$dataField['autocomplete'] = $field->isAutocomplete();
			$dataField['require'] = $field->isRequired();
			$dataField['serialized'] = $field->isSerialized();
			if(method_exists($field, 'getValues')){
				$dataField['values'] = $field->getValues();
			}
		} elseif ($field instanceof Main\Entity\ReferenceField){
			$ref = $field->getReference();
			$ref = array_shift($ref);

			preg_match('/^ref\.([a-zA-Z]+)$/i', $ref, $matchRef);

			$refEntity = $field->getRefEntity();
			$refNameShow = $matchRef[1];
			if($refEntity->hasField('NAME')){
				$refNameShow = $refEntity->getField('NAME')->getName();
			} elseif ($refEntity->hasField('TITLE')){
				$refNameShow = $refEntity->getField('TITLE')->getName();
			}
			$dataField['property'] = $field->getName().'_REF_'.$refNameShow;
			$dataField['virtual'] = true;
			$dataField['reference'] = [
				'FROM' => $field->getName(),
				'TO' => $refNameShow,
			];
		}

		return $dataField;
	}
1050958
protected function getFieldValue(string $field, string $value): array
    {
        return [
            'type' => $this->searchFields[$field]['type'],
            'operator' => key($this->searchFields[$field]['operators']),
            'value' => $value
        ];
    }
1269466
private function getAssociationByField(string $field) : ?Association
    {
        list($name) = explode('.', $this->table->aliasField($field), 2);

        if ($name === $this->table->getAlias()) {
            return null;
        }

        if (! $this->table->hasAssociation($name)) {
            throw new \RuntimeException(sprintf('Table "%s" does not have association "%s"', $this->table->getAlias(), $name));
        }

        return $this->table->getAssociation($name);
    }
241436
public function getField($field)
    {
        return $this->getFields()->filter(function($input) use ($field) {
            return $field === $input->getName();
        })->first();
    }
197360
protected function getFieldValue(array $attr, $field)
    {
        $method = 'set' . ucwords($field);

        if (method_exists($this, $method)) {
            // If there is a setter for this field, use that
            return $this->{$method}($attr[$field]);
        }

        // Otherwise just set the property
        return (isset($attr[$field])) ? $attr[$field] : null;
    }
1160360
public function getPropertyInfoForField($field)
    {
        if (!$this->loaded) {
            $this->load();
        }

        foreach ($this->propertiesInfos as $name => $infos) {
            if ($infos->getField() == $field) {
                return $infos;
            }
        }

        return false;
    }
1273537
protected function splitRelationField($field)
    {
        $parts = explode(':', $field);
        $partsCount = count($parts);

        return [implode('.', array_slice($parts, 0, $partsCount - 1)), $parts[$partsCount - 1]];
    }
6931
public function field($field)
    {
        if (!isset($field['name'])) {
            throw new SqlException("Missing column name.");
        }
        if (!isset($field['use'])) {
            if (isset($field['type'])) {
                $field += $this->type($field['type']);
            } else {
                $field += $this->type('string');
            }
        }
        return $field + [
            'name'      => null,
            'type'      => null,
            'length'    => null,
            'precision' => null,
            'serial'    => false,
            'default'   => null,
            'null'      => null
        ];
    }
81091
public function lists($field) {
        $result = $this->field($field)->get();
        $data   = [];
        if (!empty($result)) {
            $field = explode(',', $field);
            switch (count($field)) {
            case 1:
                foreach ($result as $row) {
                    $data[] = $row[$field[0]];
                }
                break;
            case 2:
                foreach ($result as $v) {
                    $data[$v[$field[0]]] = $v[$field[1]];
                }
                break;
            default:
                foreach ($result as $v) {
                    $data[$v[$field[0]]] = $v;
                }
                break;
            }

            return $data;
        }

        return [];
    }
470262
private function getPlainField($field)
    {
        if (!isset($this->fields[$field['name']])) {                     
			$this->fields[$field['name']] = $this->getDbConnection()->fetchColumn('SELECT `'.$field['name'].'` FROM '.$this->table.' WHERE id='.(int)$this->fields['id']);
		}
        return $this->fields[$field['name']];
    }
1347110
function GetOptions($field) {
		$this->LoadSchema();
		if (
			isset($this->schema[$field]) && // A valid field
			isset($this->schema[$field]['options']) // Valid options
		)
			return $this->schema[$field]['options'];
	}
46846
protected function get_field($field) {
        $fieldname = calculator::using_attempts_string_id($this->whichattempts).$field;
        return $this->{$fieldname};
    }
167905
private function getJqSearchField($field)
    {
        // jqSearchable is not initialized
        if (!isset($this->jqSearchable) || !is_array($this->jqSearchable)) {
            return $field;
        }

        return isset($this->jqSearchable[$field]) ? $this->jqSearchable[$field] : $field;
    }