Retrieves file(s) id from provided request data.
Expected formats of request data:
- Articles.photos_ids
-photos_ids

@param mixed[] $data Request data
@param string $field Field name
@return mixed[]
175035
private function getFileIdsByField(array $data, string $field) : array
    {
        $result = Hash::extract($data, sprintf('%s.%s_ids', $this->table->getAlias(), $field));
        $result = empty($result) ? Hash::extract($data, sprintf('%s_ids', $field)) : $result;
        $result = array_filter((array)$result);

        return $result;
    }
639948
protected function getFieldIdsFromSyncData(array $filesIds)
    {
        return collect($filesIds)->map(
            function ($key, $value) {
                if (is_array($key)) {
                    return $value;
                }

                return $key;
            }
        );
    }
269912
public function getTemplateData($fields, $data = [])
    {
        if ($data['METHOD'] == 'create') {
            $up = (new AddToTable)->run($fields, $data['TABLE']);
            $down = '';
        } else {
            $up = (new AddForeignKeysToTable)->run($fields, $data['TABLE']);
            $down = (new RemoveForeignKeysFromTable)->run($fields, $data['TABLE']);
        }

        return array_merge($data, [
            'UP'         => $up,
            'DOWN'       => $down
        ]);
    }
311362
protected function getDataValue($data, $field)
    {
        if (!isset($this->dataNamesMap[$field]['get'])) {
            throw new \DomainException('Field have not mapping with Data instance (field: ' . $field . ')');
        }

        $method = $this->dataNamesMap[$field]['get'];

        return $data->{$method}();
    }
824512
private function get_list_or_item($data, $field, $i = null, $default = '')
    {
        $i = ($i === false || count($this->article_ids) > 1 ) ? $i : 0;

        if ($i === null || $i === false) {
            $result = [];
            foreach ($data as $page_id => $item) {
                $result[$page_id] = isset($item[$field]) ? $item[$field] : $default;
            }
            return $result;
        }

        return isset($data[$this->article_ids[$i]][$field]) ? $data[$this->article_ids[$i]][$field] : $default;
    }
589381
public static function completeFields($data) {
		foreach( static::$fields as $fieldname ) {
			if( !isset($data[$fieldname]) ) {
				$data[$fieldname] = '';
			}
		}
		return $data;
	}
523315
public function offset_get_result($field)
    {
        $data_links = null;
        if (isset($this->links['*'])) {
            $data_links = $this->links['*'];
        } else if (isset($this->links[$field]['links'])) {
            $data_links = $this->links[$field]['links'];
        }

        $data_value = parent::offsetExists($field) ? parent::offsetGet($field) : null;

        if (is_array($data_value) && !empty($data_value)) {
            $collection = isset($this->headers['$collection']) ? $this->headers['$collection'] : null;
            $data_record = new Record(array(
                '$url' => $this->link_url($field),
                '$data' => $data_value,
                '$links' => $data_links,
                '$collection' => $collection
            ));
            $this->offsetSet($field, $data_record);
            return $data_record;
        }
        else if (!isset($data_value)) {
            // Find object within array by id
            $data = $this->getArrayCopy();
            foreach ($data as $data_val) {
                if (isset($data_val['id']) && $data_val['id'] === $field) {
                    $data_value = $data_val;
                    break;
                }
            }
        }

        return $data_value;
    }
1271111
protected function extractData($fields)
    {
        if ($this->readCallback !== null) {
            if (!isset($fields['data'])) {
                $fields['data'] = '';
            }
            $extraData = call_user_func($this->readCallback, $fields);
            if (!empty($extraData)) {
                session_decode($fields['data']);
                $_SESSION = array_merge((array) $_SESSION, (array) $extraData);
                return session_encode();
            }

            return $fields['data'];
        }

        return $fields['data'] ?? '';
    }
323889
protected function mapFields($data)
    {
        $result = [];
        $index = 0;

        foreach ($this->csvFileFieldsOrder as $value) {
            if (!empty($value)) {
                if (strtolower($data[$index]) == 'null') {
                    $result[$value] = null;
                } else {
                    $result[$value] = $data[$index];
                }
            }
            $index++;
        }

        return $result;
    }
1287623
protected function get($field)
    {
        if (isset($this->raw[$field])) {
            return $this->raw[$field];
        }
        if (preg_match('/^is_/', $field)) {
            return false;
        }

        return null;
    }
263841
public function field_format_value($fields, $data) 
    {
        if (!$fields || !$data || !is_array($data)) {
            return $data;
        }
        foreach ($fields as $field) {
            $obj = $this->get($field['fieldtype']);
            if (!$obj) {
                continue;
            }
            if ($field['fieldtype'] === 'Group') {
                continue;
            }
            $data = $obj->output_data($data, $field);
        }
        return $data;
    }
840312
protected function getSortingFieldValue($data, $fields)
	{
		if(is_object($data))
		{
			foreach($fields as $field)
				$data=isset($data->$field) ? $data->$field : null;
		}
		else
		{
			foreach($fields as $field)
				$data=isset($data[$field]) ? $data[$field] : null;
		}
		return $this->caseSensitiveSort ? $data : mb_strtolower($data,Yii::app()->charset);
	}
223514
public function getIndexData(Field $field, FieldDefinition $fieldDefinition)
    {
        if (empty($field->value->data)) {
            return array();
        }

        $nameList = array();
        $IDCList = array();
        $alpha2List = array();
        $alpha3List = array();

        foreach ($field->value->data as $alpha2) {
            if (isset($this->countriesInfo[$alpha2])) {
                $nameList[] = $this->countriesInfo[$alpha2]['Name'];
                $IDCList[] = $this->countriesInfo[$alpha2]['IDC'];
                $alpha2List[] = $this->countriesInfo[$alpha2]['Alpha2'];
                $alpha3List[] = $this->countriesInfo[$alpha2]['Alpha3'];
            }
        }

        return array(
            new Search\Field(
                'idc',
                $IDCList,
                new Search\FieldType\MultipleIntegerField()
            ),
            new Search\Field(
                'alpha2',
                $alpha2List,
                new Search\FieldType\MultipleStringField()
            ),
            new Search\Field(
                'alpha3',
                $alpha3List,
                new Search\FieldType\MultipleStringField()
            ),
            new Search\Field(
                'name',
                $nameList,
                new Search\FieldType\MultipleStringField()
            ),
            new Search\Field(
                'sort_value',
                $field->value->sortKey,
                new Search\FieldType\StringField()
            ),
            new Search\Field(
                'fulltext',
                $nameList,
                new Search\FieldType\FullTextField()
            ),
        );
    }
866516
protected function fields(array $fields)
    {
        $result = array();
        foreach ($fields as $id => $field) {
            if (!isset($field['id'])) {
                $field['id'] = $id;
            }
            if (!isset($field['name'])) {
                $field['name'] = $id;
            }
            $result[$id] = $this->field($field);
        }
        return $result;
    }
330535
public function getData($field = null)
    {
        if ($field === null) {
            return $this->_data;
        }

        return Hash::get($this->_data, $field);
    }
857993
public function exif(array $fields = array()) {
        if (!function_exists('exif_read_data')) {
            return array();
        }

        return $this->_cache(__FUNCTION__, function($file) use ($fields) {
            /** @type \Transit\File $file */

            $exif = array();
            $fields = $fields + array(
                'make' => 'Make',
                'model' => 'Model',
                'exposure' => 'ExposureTime',
                'orientation' => 'Orientation',
                'fnumber' => 'FNumber',
                'date' => 'DateTime',
                'iso' => 'ISOSpeedRatings',
                'focal' => 'FocalLength',
                'latitude' => 'GPSLatitude',
                'longitude' => 'GPSLongitude'
            );

            if ($file->supportsExif()) {
                if ($data = @exif_read_data($file->path())) {
                    foreach ($fields as $key => $find) {
                        $value = '';

                        if (!empty($data[$find])) {
                            // Convert DMS (degrees, minutes, seconds) to decimals
                            if ($key === 'latitude' || $key === 'longitude'){
                                $deg = $data[$find][0];
                                $min = $data[$find][1];
                                $sec = $data[$find][2];
                                $value = $deg + ((($min * 60) + $sec) / 3600);

                            } else {
                                $value = $data[$find];
                            }
                        }

                        $exif[$key] = $value;
                    }
                }
            }

            // Return empty values for files that don't support exif
            if (!$exif) {
                $exif = array_map(function() {
                    return '';
                }, $fields);
            }

            return $exif;
        });
    }
685222
public function getIndexData(Field $field, FieldDefinition $fieldDefinition)
    {
        return array(
            new Search\Field(
                'file_name',
                $field->value->externalData['fileName'],
                new Search\FieldType\StringField()
            ),
            new Search\Field(
                'file_size',
                $field->value->externalData['fileSize'],
                new Search\FieldType\IntegerField()
            ),
            new Search\Field(
                'mime_type',
                $field->value->externalData['mimeType'],
                new Search\FieldType\StringField()
            ),
        );
    }