Returns an array of field values for a given field
@return array
439579
protected function getListFieldValue()
    {
        $conditions = $this->query_filter;
        $conditions['limit'] = $this->data_limit;
        $conditions['field_id'] = $this->data_field['field_id'];

        $list = (array) $this->field_value->getList($conditions);
        $this->prepareListFieldValue($list);
        return $list;
    }
710162
public function asArray()
    {
        $fields = [
            '@type' => $this->type(),
            '@key'  => $this->key(),
        ];

        foreach ($this->fields as $name => $field) {
            $fields[$name] = $field->value;
        }

        return $fields;
    }
646716
public function getAllFields()
    {
        $fields = [];
        foreach ($this->fields as $group) {
            foreach ($group as $field) {
                $fields[$field->getName()] = $field;
            }
        }
        return $fields;
    }
993950
public function getFieldValues($key)
    {
        $values = array();
        $key = strtolower($key);

        foreach ($this->fields as $part => $value) {
            if (strtolower($part) === $key) {
                if (is_array($value)) {
                    foreach ($value as $v) {
                        $values []= $v;
                    }
                } else {
                    $values []= $value;
                }
            }
        }

        return $values;
    }
1088723
protected function getFields()
    {
        $fields = [];

        foreach ($this as $k => $v) {
            if (is_string($k) && strpos($k, '_') !== 0) {
                $fields[] = $k;
            }
        }

        foreach ($this->_fields as $k => $v) {
            if (is_string($k)) {
                $fields[] = $k;
            }
        }

        return $fields;
    }
82176
public function getFieldNames()
    {
        $names = array();

        foreach ($this->getFields() as $field) {
            $names[] = $field->name;
        }

        return $names;
    }
1099388
protected function get_fieldlist() : array {
        global $DB;

        if (null === $this->fields) {
            $fields = [];
            foreach (array_keys($DB->get_columns($this->tablename)) as $fieldname) {
                $fields["{$this->fieldprefix}{$fieldname}"] = $fieldname;
            }

            $this->fields = $fields;
        }

        return $this->fields;
    }
241477
protected function _getFieldsFromConfig($fields = null) {
		$result = [];
		if (empty($fields)) {
			return $result;
		}

		if (!is_array($fields)) {
			$result = [$fields];
		} else {
			$result = array_keys($fields);
		}

		return $result;
	}
111152
public function customFieldsToArray()
    {
        $result = [];
        foreach ($this->getCustomFields() as $field) {
            $result[$field->getInternalFieldName()] = $field->getValue();
        }

        return $result;
    }
889781
public function getValuesAsArray() {
		$values = [];
		foreach($this->getValues() as $value) {
			$values[$value->getId()] = $value->getName();
		}

		return $values;
	}
583272
public function toArray()
    {
        if ($this->field === null || $this->value === null) {
            throw new InvalidArgument('"field" and "value" must be set for this type of query');
        }

        $definition = [
            'value' => $this->getValue(),
        ];

        if ($this->hasBoost()) {
            $definition['boost'] = $this->getBoost();
        }

        return [
            'wildcard' => [
                $this->getField() => $definition,
            ],
        ];
    }
1343933
public function getFields()
    {
        $fields = $this->getInput('fields');

        if (! is_array($fields)) {
            return [];
        }

        return array_map(function ($fields) {
            return explode(',', $fields);
        }, $fields);
    }
235987
protected function _fields()
    {
        $schema = $this->_table->getSchema();
        $fields = $schema->columns();
        if ($this->_config['fields'] !== null) {
            $fields = array_intersect($fields, (array)$this->_config['fields']);
        }

        return $fields;
    }
298667
public function getValues()
    {
        $contentType = $this->getContenttype();
        if (!isset($contentType['fields'])) {
            return [];
        }

        $allValues = $this->toArray();

        return array_intersect_key($allValues, ($contentType['fields']));
    }
1270444
public function indexFields()
    {
        $fields = [];
        foreach ($this->indexes as $index) {
            $fields = array_merge($fields, $index->fields());
        }

        $result = [];
        foreach (array_unique($fields) as $field) {
            $result[] = $this->field($field);
        }

        return $result;
    }
533407
final public function toArray()
    {
        $this->checkRequiredFields();

        $fields = get_object_vars($this);

        $array = [];
        foreach ($fields as $field => $value) {
            $array[$field] = $this->transformToArray($this->getAttribute($field));
        }

        return $array;
    }
11721
public function getFields()
    {
        $fields = [];
        foreach ($this->fieldsets as $fieldset) {
            $fields = array_merge($fields, $fieldset->getAllFields());
        }
        return $fields;
    }