Get the first has_one Image/File relation from the GridField managed DataObject
i.e. 'MyImage' => 'Image' will return 'MyImage'.

@param  GridField $gridField
@return string Name of the $has_one relation
490721
public function getDefaultFileRelationName($gridField)
    {
        $recordClass = $this->getRecordClassName($gridField);
        $hasOneFields = Config::inst()->get($recordClass, 'has_one');

        $imageField = null;
        foreach ($hasOneFields as $field => $type) {
            if ($type === 'SilverStripe\\Assets\\Image'
                ||  $type === 'SilverStripe\\Assets\\File'
                || is_subclass_of($type, 'SilverStripe\\Assets\\File')
            ) {
                $imageField = $field;
                break;
            }
        }

        return $imageField;
    }
1072822
protected function _isImageField($sFieldName)
    {
        return (stristr($sFieldName, '_oxthumb') || stristr($sFieldName, '_oxicon') || stristr(
            $sFieldName,
            '_oxzoom'
        ) || stristr($sFieldName, '_oxpic'));
    }
303412
protected function getRelationName($recordField)
    {
        $relationName = null;
        if (isset($this->relationCallbacks[$recordField])) {
            $relationName = $this->relationCallbacks[$recordField]['relationname'];
        }
        if (strpos($recordField, '.') !== false) {
            list($relationName, $columnName) = explode('.', $recordField);
        }

        return $relationName;
    }
1172088
public function getTitle(GridField $gridField)
    {
        $form = $gridField->getForm();
        $currentController = $gridField->getForm()->getController();
        $title = '';

        if (method_exists($currentController, 'Title')) {
            $title = $currentController->Title();
        } else {
            if ($currentController->Title) {
                $title = $currentController->Title;
            } elseif ($form->getName()) {
                $title = $form->getName();
            }
        }

        if ($fieldTitle = $gridField->Title()) {
            if ($title) {
                $title .= " - ";
            }

            $title .= $fieldTitle;
        }

        return $title;
    }
985360
public function getSearchFieldSchema(GridField $gridField)
    {
        $schemaUrl = Controller::join_links($gridField->Link(), 'schema/SearchForm');

        $context = $this->getSearchContext($gridField);
        $params = $gridField->getRequest()->postVar('filter') ?: [];
        if (array_key_exists($gridField->getName(), $params)) {
            $params = $params[$gridField->getName()];
        }
        if ($context->getSearchParams()) {
            $params = array_merge($context->getSearchParams(), $params);
        }
        $context->setSearchParams($params);

        $searchField = $context->getSearchFields()->first();
        $searchField = $searchField && property_exists($searchField, 'name') ? $searchField->name : null;

        $name = $gridField->Title ?: singleton($gridField->getModelClass())->i18n_plural_name();

        // Prefix "Search__" onto the filters for the React component
        $filters = $context->getSearchParams();
        if (!$this->useLegacyFilterHeader && !empty($filters)) {
            $filters = array_combine(array_map(function ($key) {
                return 'Search__' . $key;
            }, array_keys($filters)), $filters);
        }

        $searchAction = GridField_FormAction::create($gridField, 'filter', false, 'filter', null);
        $clearAction = GridField_FormAction::create($gridField, 'reset', false, 'reset', null);
        $schema = [
            'formSchemaUrl' => $schemaUrl,
            'name' => $searchField,
            'placeholder' => _t(__CLASS__ . '.Search', 'Search "{name}"', ['name' => $name]),
            'filters' => $filters ?: new \stdClass, // stdClass maps to empty json object '{}'
            'gridfield' => $gridField->getName(),
            'searchAction' => $searchAction->getAttribute('name'),
            'searchActionState' => $searchAction->getAttribute('data-action-state'),
            'clearAction' => $clearAction->getAttribute('name'),
            'clearActionState' => $clearAction->getAttribute('data-action-state'),
        ];

        return json_encode($schema);
    }
142744
public function getColumnContent($gridField, $record, $columnName)
    {
        $data = new ArrayData(array(
            'Link' => $record->hasMethod('getExternalLink') ? $record->getExternalLink() : $record->ExternalLink,
            'Text' => $record->hasMethod('getExternalLinkText') ? $record->getExternalLinkText() : 'External Link'
        ));

        return $data->renderWith('GridFieldExternalLink');
    }
729663
public function getRelatedField()
    {
        $field = $this->toModel->getMeta()->getField($this->fieldName);
        if (!$field->concrete) {
            throw new FieldDoesNotExist(sprintf("No related field named '%s'", $this->fieldName));
        }

        return $field;
    }
1316740
private function getRelation($field)
    {
        $relations = $this->getRelations();
        return isset($relations[$field]) ? $relations[$field] : null;
    }
969112
public function hasFieldValue($field)
    {
        $newFiles = array_get($this->files, 'new.image', []);

        foreach ($newFiles as $fieldName => $file) {
            if ($fieldName == $field) {
                return true;
            }
        }

        $existingFiles = array_get($this->files, 'image', []);

        foreach ($existingFiles as $fieldName => $files) {
            if ($fieldName == $field) {
                $deleted = 0;
                $fileCount = count($files);
                foreach ($files as $file) {
                    if ($file['delete']) {
                        ++$deleted;
                    }
                }
                if ($fileCount == $deleted) {
                    return false;
                } else {
                    return true;
                }
            }
        }

        return false;
    }
885110
public function getFilteredRecordList($gridfield)
    {
        $list = $gridfield->getList();

        foreach ($gridfield->getComponents() as $item) {
            if ($item instanceof GridField_DataManipulator && !$item instanceof GridFieldPaginator) {
                $list = $item->getManipulatedData($gridfield, $list);
            }
        }

        return $list;
    }
899535
public function get($field)
    {
        if (!is_null($this->filtered) && ! is_null($this->filtered[0])) {
            return isset($this->filtered[0][0][$field]) ? $this->filtered[0][0][$field] : null;
        }

        // Todo: Get values of entities
    }
540510
public static function getField($field)
    {
        return isset(self::$fields[$field]) ? self::$fields[$field] : null;
    }
871520
public static function apply(
        GridField $gridField,
        array $config = []
    ) {
        $config = array_merge(self::default_config(), $config);
        $bulkUploader = new BulkUploader();

        foreach ($config as $key => $value)
        {
            $bulkUploader->setConfig($key, $value);
        }

        $gridField
            ->getConfig()
            ->addComponent(
                $bulkUploader
                    ->setUfSetup('setFolderName', $config['folderName'])
                    ->setAutoPublishDataObject(true)
            )
        ;

        return $gridField;
    }
422289
public function getColumnContent($gridField, $record, $columnName)
    {
        if ($columnName === self::CHECKBOX_COLUMN) {
            return '<input class="multiselect no-change-track" type="checkbox"
					name="' . $columnName . '[' . $record->ID . ']"
					value="' . $record->ID . '">';
        } else {
            return null;
        }
    }
589600
public function getDisplayFields($gridField)
    {
        if (!$this->displayFields) {
            return singleton($gridField->getModelClass())->summaryFields();
        }
        return $this->displayFields;
    }
5858
public function getHTMLFragments($gridField)
    {
        // permission check
        if (!singleton($gridField->getModelClass())->canEdit()) {
            return array();
        }

        // get uploadField
        $uploadField = $this->bulkUploadField($gridField);

        $data = ArrayData::create(array(
            'Colspan' => (count($gridField->getColumns())),
            'UploadField' => $uploadField->Field() // call ->Field() to get requirements in right order
        ));

        Requirements::javascript('colymba/gridfield-bulk-editing-tools:client/dist/js/main.js');
        Requirements::css('colymba/gridfield-bulk-editing-tools:client/dist/styles/main.css');
        Requirements::add_i18n_javascript('colymba/gridfield-bulk-editing-tools:client/lang');

        return array(
            'before' => $data->renderWith('Colymba\\BulkUpload\\BulkUploader'),
        );
    }
1035718
public function getColumnMetadata($gridField, $column)
    {
        if ($column === self::CHECKBOX_COLUMN) {
            $title = _t('GridFieldMultiSelect.SelectAllVisibleRows', 'Select all visible rows');
            return array(
                'title' => '<input class="multiselect-all no-change-track" type="checkbox"
								title="' . htmlentities($title) . '">',
            );
        }
    }