public function importField($field)
{
$field = $this->model->hasElement($field);
if (!$field) {
return;
}
/** @type Field $field */
$field_name = $field->short_name;
if ($field instanceof Field_Reference) {
$field_name = $field->getDereferenced();
}
$field_type = $this->getFieldType($field);
/** @type string $field_caption */
$field_caption = $field->caption();
$this->field_associations[$field_name] = $field;
$column = $this->owner->addColumn($field_type, $field_name, $field_caption);
if ($field->sortable() && $column->hasMethod('makeSortable')) {
$column->makeSortable();
}
return $column;
}