lib/components/types/ActiveRecordTrait.php
public function getFields($owner = null)
    {
        if (!isset($this->_fields)) {
            $disabledFields = $this->objectType->disabledFields;
            $modelName = self::className();
            $this->_fields = [];
            $fieldSettings = $this->fieldSettings();
            $aliases = [];
            foreach (self::getTableSchema()->columns as  $name => $column) {
                if (in_array($name, $disabledFields)) {
                    continue;
                }
                $settings = [];
                if (isset($fieldSettings[$name])) {
                    $settings = array_merge_recursive($settings, $fieldSettings[$name]);
                }
                if (isset($settings['alias'])) {
                    $aliases[$name] = $settings['alias'];
                    unset($settings['alias']);
                }
                if (is_array($column)) {
                    $column = $this->createColumnSchema($name, $column);
                }
                $this->_fields[$name] = $this->createField($column, $owner, $settings);
            }

            $objectTypeItem = $this->objectTypeItem;
            if ($objectTypeItem) {
                $relationRelationship = null;
                $relationClass = Yii::$app->classes['Relation'];
                $taxonomies = $objectTypeItem->taxonomies;
                foreach ($objectTypeItem->parents as $relationship) {
                    $fieldName = 'parent:' . $relationship->parent->systemId;
                    if (in_array($fieldName, $disabledFields)) {
                        continue;
                    }
                    $fieldSchema = $this->createColumnSchema($fieldName, ['type' => 'relation', 'phpType' => 'object', 'dbType' => 'relation', 'allowNull' => true]);
                    $settings = [];
                    if (isset($fieldSettings[$fieldName])) {
                        $settings = array_merge_recursive($settings, $fieldSettings[$fieldName]);
                    }
                    if (isset($settings['alias'])) {
                        $aliases[$fieldName] = $settings['alias'];
                        unset($settings['alias']);
                    }
                    $settings['modelRole'] = 'child';
                    $settings['relationship'] = $relationship;
                    $this->_fields[$fieldName] = $this->createRelationField($fieldSchema, $owner, $settings);
                }

                foreach ($objectTypeItem->children as $relationship) {
                    $fieldName = 'child:' . $relationship->child->systemId;
                    if (in_array($fieldName, $disabledFields)) {
                        continue;
                    }
                    $fieldSchema = $this->createColumnSchema($fieldName, ['type' => 'relation', 'phpType' => 'object', 'dbType' => 'relation', 'allowNull' => true]);
                    $settings = [];
                    if (isset($fieldSettings[$fieldName])) {
                        $settings = array_merge_recursive($settings, $fieldSettings[$fieldName]);
                    }
                    if (isset($settings['alias'])) {
                        $aliases[$fieldName] = $settings['alias'];
                        unset($settings['alias']);
                    }
                    $settings['modelRole'] = 'parent';
                    $settings['relationship'] = $relationship;
                    $this->_fields[$fieldName] = $this->createRelationField($fieldSchema, $owner, $settings);
                }

                foreach ($taxonomies as $taxonomy) {
                    if (!in_array(self::className(), $taxonomy->models)) {
                        continue;
                    }

                    $fieldName = 'taxonomy:' . $taxonomy->systemId;
                    if (in_array($fieldName, $disabledFields)) {
                        continue;
                    }
                    $fieldSchema = $this->createColumnSchema($fieldName, ['type' => 'taxonomy', 'phpType' => 'object', 'dbType' => 'taxonomy', 'allowNull' => true]);

                    $settings = [];
                    if (isset($fieldSettings[$fieldName])) {
                        $settings = array_merge_recursive($settings, $fieldSettings[$fieldName]);
                    }
                    if (isset($settings['alias'])) {
                        $aliases[$fieldName] = $settings['alias'];
                        unset($settings['alias']);
                    }
                    $settings['model'] = $this;
                    $this->_fields[$fieldName] = $this->createTaxonomyField($fieldSchema, $taxonomy, $owner);
                }
            }

            foreach ($this->additionalFields() as $name => $column) {
                if (in_array($name, $disabledFields)) {
                    continue;
                }
                $settings = [];
                if (isset($fieldSettings[$name])) {
                    $settings = array_merge_recursive($settings, $fieldSettings[$name]);
                }
                if (isset($settings['alias'])) {
                    $aliases[$name] = $settings['alias'];
                    unset($settings['alias']);
                }
                if (is_string($column) && isset($this->_fields[$column])) {
                    $this->_fields[$name] = $this->duplicateField($name, $this->_fields[$column], $owner, $settings);
                } elseif (is_array($column)) {
                    $column = $this->createColumnSchema($name, $column);
                    $this->_fields[$name] = $this->createField($column, $owner, $settings);
                } else {
                    $this->_fields[$name] = $this->createField($column, $owner, $settings);
                }
            }
            foreach ($aliases as $from => $to) {
                if (isset($this->_fields[$to])) {
                    $this->_fields[$from] = $this->_fields[$to];
                }
            }
            $currentKeys = array_keys($this->_fields);
            foreach ($this->_fields as $name => $field) {
                if (!isset($field->priority)) {
                    $field->priority = (int) array_search($name, $currentKeys);
                    $field->priority = ($field->priority * 100);
                }
            }
            $this->_fields['relationTaxonomies'] = $this->createRelationTaxonomyField($owner, []);
            ArrayHelper::multisort($this->_fields, 'priority', SORT_ASC);
        }
        if (!empty($owner)) {
            foreach ($this->_fields as $field) {
                if (!$field->formField) {
                    continue;
                }
                $field->formField->owner = $owner;
            }
        }

        return $this->_fields;
    }
public function getFields($owner = null)
    {
        if (!isset($this->_fields)) {
            $disabledFields = $this->objectType->disabledFields;
            $modelName = self::className();
            $this->_fields = [];
            $fieldSettings = $this->fieldSettings();
            $aliases = [];
            foreach (self::getTableSchema()->columns as  $name => $column) {
                if (in_array($name, $disabledFields)) {
                    continue;
                }
                $settings = [];
                if (isset($fieldSettings[$name])) {
                    $settings = array_merge_recursive($settings, $fieldSettings[$name]);
                }
                if (isset($settings['alias'])) {
                    $aliases[$name] = $settings['alias'];
                    unset($settings['alias']);
                }
                if (is_array($column)) {
                    $column = $this->createColumnSchema($name, $column);
                }
                $this->_fields[$name] = $this->createField($column, $owner, $settings);
            }

            $objectTypeItem = $this->objectTypeItem;
            if ($objectTypeItem) {
                $relationRelationship = null;
                $relationClass = Yii::$app->classes['Relation'];
                $taxonomies = $objectTypeItem->taxonomies;
                foreach ($objectTypeItem->parents as $relationship) {
                    $fieldName = 'parent:' . $relationship->parent->systemId;
                    if (in_array($fieldName, $disabledFields)) {
                        continue;
                    }
                    $fieldSchema = $this->createColumnSchema($fieldName, ['type' => 'relation', 'phpType' => 'object', 'dbType' => 'relation', 'allowNull' => true]);
                    $settings = [];
                    if (isset($fieldSettings[$fieldName])) {
                        $settings = array_merge_recursive($settings, $fieldSettings[$fieldName]);
                    }
                    if (isset($settings['alias'])) {
                        $aliases[$fieldName] = $settings['alias'];
                        unset($settings['alias']);
                    }
                    $settings['modelRole'] = 'child';
                    $settings['relationship'] = $relationship;
                    $this->_fields[$fieldName] = $this->createRelationField($fieldSchema, $owner, $settings);
                }

                foreach ($objectTypeItem->children as $relationship) {
                    $fieldName = 'child:' . $relationship->child->systemId;
                    if (in_array($fieldName, $disabledFields)) {
                        continue;
                    }
                    $fieldSchema = $this->createColumnSchema($fieldName, ['type' => 'relation', 'phpType' => 'object', 'dbType' => 'relation', 'allowNull' => true]);
                    $settings = [];
                    if (isset($fieldSettings[$fieldName])) {
                        $settings = array_merge_recursive($settings, $fieldSettings[$fieldName]);
                    }
                    if (isset($settings['alias'])) {
                        $aliases[$fieldName] = $settings['alias'];
                        unset($settings['alias']);
                    }
                    $settings['modelRole'] = 'parent';
                    $settings['relationship'] = $relationship;
                    $this->_fields[$fieldName] = $this->createRelationField($fieldSchema, $owner, $settings);
                }

                foreach ($taxonomies as $taxonomy) {
                    if (!in_array(self::className(), $taxonomy->models)) {
                        continue;
                    }

                    $fieldName = 'taxonomy:' . $taxonomy->systemId;
                    if (in_array($fieldName, $disabledFields)) {
                        continue;
                    }
                    $fieldSchema = $this->createColumnSchema($fieldName, ['type' => 'taxonomy', 'phpType' => 'object', 'dbType' => 'taxonomy', 'allowNull' => true]);

                    $settings = [];
                    if (isset($fieldSettings[$fieldName])) {
                        $settings = array_merge_recursive($settings, $fieldSettings[$fieldName]);
                    }
                    if (isset($settings['alias'])) {
                        $aliases[$fieldName] = $settings['alias'];
                        unset($settings['alias']);
                    }
                    $settings['model'] = $this;
                    $this->_fields[$fieldName] = $this->createTaxonomyField($fieldSchema, $taxonomy, $owner);
                }
            }

            foreach ($this->additionalFields() as $name => $column) {
                if (in_array($name, $disabledFields)) {
                    continue;
                }
                $settings = [];
                if (isset($fieldSettings[$name])) {
                    $settings = array_merge_recursive($settings, $fieldSettings[$name]);
                }
                if (isset($settings['alias'])) {
                    $aliases[$name] = $settings['alias'];
                    unset($settings['alias']);
                }
                if (is_string($column) && isset($this->_fields[$column])) {
                    $this->_fields[$name] = $this->duplicateField($name, $this->_fields[$column], $owner, $settings);
                } elseif (is_array($column)) {
                    $column = $this->createColumnSchema($name, $column);
                    $this->_fields[$name] = $this->createField($column, $owner, $settings);
                } else {
                    $this->_fields[$name] = $this->createField($column, $owner, $settings);
                }
            }
            foreach ($aliases as $from => $to) {
                if (isset($this->_fields[$to])) {
                    $this->_fields[$from] = $this->_fields[$to];
                }
            }
            $currentKeys = array_keys($this->_fields);
            foreach ($this->_fields as $name => $field) {
                if (!isset($field->priority)) {
                    $field->priority = (int) array_search($name, $currentKeys);
                    $field->priority = ($field->priority * 100);
                }
            }
            $this->_fields['relationTaxonomies'] = $this->createRelationTaxonomyField($owner, []);
            ArrayHelper::multisort($this->_fields, 'priority', SORT_ASC);
        }
        if (!empty($owner)) {
            foreach ($this->_fields as $field) {
                if (!$field->formField) {
                    continue;
                }
                $field->formField->owner = $owner;
            }
        }

        return $this->_fields;
    }
@param unknown $model                 (optional)
@param unknown $univeralFieldSettings (optional)

@return unknown