Returns a list of profile field objects after synchronising them with the
Member form fields.

@return HasManyList|UnsavedRelationList Fields()
195881
public function Fields()
    {
        $list     = $this->getComponents('Fields');
        $fields   = singleton(Member::class)->getMemberFormFields()->dataFields();
        $included = array();

        foreach ($list as $profileField) {
            if (!array_key_exists($profileField->MemberField, $fields)) {
                $profileField->delete();
            } else {
                $included[] = $profileField->MemberField;
            }
        }

        foreach ($fields as $name => $field) {
            if (!in_array($name, $included)) {
                $profileField = new MemberProfileField();
                $profileField->MemberField = $name;

                if (isset(self::$profile_field_defaults[$name])) {
                    $profileField->update(self::$profile_field_defaults[$name]);
                }

                $list->add($profileField);
            }
        }

        return $list;
    }
366775
public function getFieldChoices()
    {
        $fields = [];
        foreach ($this->getMeta()->getFields() as $field) {
            if (!$field->isRelation) {
                continue;
            }
            $fields[] = $field->getName();
        }

        foreach ($this->getMeta()->getReverseRelatedObjects() as $reverseRelatedObject) {
            if ($reverseRelatedObject->relation->fromField->isUnique()) {
                $fields[] = $reverseRelatedObject->relation->fromField->getRelatedQueryName();
            }
        }

        return $fields;
    }
365791
public function getFields()
    {
        $model = $this->getModelInstance();
        $fields = $model->getFillable();
        $filtered_fields = [];

        foreach ($fields as $f) {
            if ($f !== 'password' && $f !== 'Password') {
                $filtered_fields[] = $f;
            }
        }

        return $filtered_fields;
    }
859367
public function get_profile_fields($field = null, $default = null)
	{
		// collect all meta data
		$profile_fields = array();

		foreach ($this->user->metadata as $metadata)
		{
			if (empty($field))
			{
				$profile_fields[$metadata->key] = $metadata->value;
			}
			elseif ($field == $metadata->key)
			{
				return $metadata->value;
			}
		}

		// return the connected data
		return empty($profile_fields) ? $default : $profile_fields;
	}
1059061
public function getCMSFields()
    {
        // Obtain Field Objects (from parent):
        
        $fields = parent::getCMSFields();
        
        // Create Options Fields:
        
        $fields->addFieldToTab(
            'Root.Options',
            FieldSection::create(
                'NavigationOptions',
                $this->fieldLabel('NavigationOptions'),
                [
                    CheckboxField::create(
                        'HideTopLevel',
                        $this->fieldLabel('HideTopLevel')
                    )
                ]
            )
        );
        
        // Answer Field Objects:
        
        return $fields;
    }
11721
public function getFields()
    {
        $fields = [];
        foreach ($this->fieldsets as $fieldset) {
            $fields = array_merge($fields, $fieldset->getAllFields());
        }
        return $fields;
    }
284518
public function getHasOnes()
    {
        $modelNameSpace = $this->relation->getReferencedModel();
        $list = [];
        $relationships = $this->modelManager->getRelations($modelNameSpace);
        foreach ($relationships as $relation) {
            $refType = $relation->getType();
            if ($refType == 1) {
                $list[] = $relation->getReferencedModel();
            }
        }

        return $list;
    }
117257
public function getFields()
    {
        $fields = array_keys($this->fillable);
        if (!empty($fields) && is_integer($fields[0]))
            // only alias provided
            $fields = array_values($this->fillable);

        return array_merge($fields, $this->appends, array_keys($this->attributes));
    }
1077231
public function getCMSFields()
    {
        // Obtain Field Objects (from parent):
        
        $fields = parent::getCMSFields();
        
        // Create Options Fields:
        
        $fields->addFieldsToTab(
            'Root.Options',
            [
                FieldSection::create(
                    'NavigationOptions',
                    $this->fieldLabel('NavigationOptions'),
                    [
                        ToggleGroup::create(
                            'ShowSubMenus',
                            $this->fieldLabel('ShowSubMenus'),
                            [
                                CheckboxField::create(
                                    'MultiLevelSubMenus',
                                    $this->fieldLabel('MultiLevelSubMenus')
                                ),
                                CheckboxField::create(
                                    'AddTopLinkToSub',
                                    $this->fieldLabel('AddTopLinkToSub')
                                ),
                                CheckboxField::create(
                                    'ShowDivider',
                                    $this->fieldLabel('ShowDivider')
                                ),
                                TextField::create(
                                    'MaximumSubMenuLevel',
                                    $this->fieldLabel('MaximumSubMenuLevel')
                                )
                            ]
                        )->addExtraClass('sub-menu-options')
                    ]
                )->addExtraClass('navigation-item-options')
            ]
        );
        
        // Answer Field Objects:
        
        return $fields;
    }
509674
public function getCMSFields()
    {
        $fields = $this->scaffoldFormFields(
            array(
                // Don't allow has_many/many_many relationship editing before the record is first saved
                'includeRelations' => ($this->ID > 0),
                'tabbed' => true,
                'ajaxSafe' => true
            )
        );
        $fields->removeByName(
            array(
                'Title',
                'Instance',
                'Style',
                'Objects'
            )
        );
        if (!$this->IsMain) {
            $fields->addFieldsToTab(
                'Root.Main',
                array(
                    TextField::create(
                        'Title',
                        _t('PlaceableObject_Preset.TITLE', 'Title')
                    ),
                    DropdownField::create(
                        'Instance',
                        _t('PlaceableObject_Preset.INSTANCE', 'Instance'),
                        singleton('PlaceableObject_Preset')->dbObject('Instance')->enumValues()
                    )
                )
            );
        }
        if ($this->Styles) {
            $fields->addFieldToTab(
                'Root.Main',
                DropdownField::create(
                    'Style',
                    _t('PlaceableObject_Preset.STYLE', 'Style'),
                    $this->Styles
                )->setEmptyString(_t('PlaceableObject_Preset.DEFAULTSTYLE', 'Default'))
            );
        }
        $fields->addFieldsToTab(
            'Root.Objects',
            array(
                LabelField::create(
                    'ObjectsDescription',
                    _t('PlaceableObject_Preset.OBJECTSDESCRIPTION', 'List of all objects that use this use this preset.')
                ),
                GridField::create(
                    'Objects',
                    _t('PlaceableObject_Preset.OBJECTS', 'Objects'),
                    $this->Objects(),
                    GridFieldConfig_Base::create()
                )
            )
        );
        $this->extend('updateCMSFields', $fields);
        return $fields;
    }
851492
public function getCMSFields()
    {
        $fields = parent::getCMSFields();

        $listGridConfig = GridFieldConfig_RelationEditor::create();
        if ($this->Items()->Count() > 0) {
            $listGridConfig->addComponent(new GridFieldOrderableRows());
        }

        $fields->addFieldToTab(
            'Root.Main',
            GridField::create(
                'Items',
                'List',
                $this->Items(),
                $listGridConfig
            )
        );

        $this->extend('updateCMSFields', $fields);

        return $fields;
    }
148323
public function getUsedFields()
    {
        if (empty($this->usedFields)) {
            $this->usedFields = [];
            foreach (AddressField::getAll() as $field) {
                if (strpos($this->format, '%' . $field) !== false) {
                    $this->usedFields[] = $field;
                }
            }
        }

        return $this->usedFields;
    }
451444
public function getRelationships()
    {
        if (empty(static::$relationHooks)) {
            $hooks = [];

            $rels = $this->getRelationshipsFromMethods(true);

            $this->getRelationshipsUnknownPolyMorph($rels, $hooks);

            $this->getRelationshipsKnownPolyMorph($rels, $hooks);

            $this->getRelationshipsHasOne($rels, $hooks);

            $this->getRelationshipsHasMany($rels, $hooks);

            static::$relationHooks = $hooks;
        }

        return static::$relationHooks;
    }
1114775
public function listProfiles() {
    $dirs = $this->config['profile.dirs'];
    $profiles = array();
    foreach ($dirs as $dir) {
      if (!is_dir($dir) || !is_readable($dir)) {
        continue;
      }
      $files = scandir($dir);
      foreach ($files as $file) {
        if (preg_match('/(.*)\.profile$/', $file, $m)) {
           $profiles[] = $m[1];
        }
      }
    }
    return $profiles;
  }
1211287
public function getListFieldsDb() {
		$result = [];
		$fieldsInfo = $this->getLocalFieldsInfo();
		$fieldsInfo += $this->getLdapFieldsInfo();
		if (empty($fieldsInfo)) {
			return $result;
		}

		$excludeFields = $this->_getListBindFields();
		$fields = array_keys($fieldsInfo);
		$result = array_values(array_diff($fields, array_keys($excludeFields)));

		return $result;
	}
677097
public function getCMSFields()
    {
        // Obtain Field Objects (from parent):
        
        $fields = parent::getCMSFields();
        
        // Modify Field Objects:
        
        $fields->fieldByName('Root.Style.TitleStyle')->setTitle('Heading');
        
        // Remove Field Objects:
        
        $fields->removeFieldFromTab('Root.Options', 'TitleOptions');
        
        // Answer Field Objects:
        
        return $fields;
    }
1031803
protected function buildRelatedForms()
    {
        if (is_null($this->form)) {
            return [];
        }

        $model = $this->form->model();

        $relation = call_user_func([$model, $this->relationName]);

        if (!$relation instanceof Relation && !$relation instanceof MorphMany) {
            throw new \Exception('hasMany field must be a HasMany or MorphMany relation.');
        }

        $forms = [];

        /*
         * If redirect from `exception` or `validation error` page.
         *
         * Then get form data from session flash.
         *
         * Else get data from database.
         */
        if ($values = old($this->column)) {
            foreach ($values as $key => $data) {
                if ($data[NestedForm::REMOVE_FLAG_NAME] == 1) {
                    continue;
                }

                $model = $relation->getRelated()->replicate()->forceFill($data);

                $forms[$key] = $this->buildNestedForm($this->column, $this->builder, $model)
                    ->fill($data);
            }
        } else {
            foreach ($this->value as $data) {
                $key = Arr::get($data, $relation->getRelated()->getKeyName());

                $model = $relation->getRelated()->replicate()->forceFill($data);

                $forms[$key] = $this->buildNestedForm($this->column, $this->builder, $model)
                    ->fill($data);
            }
        }

        return $forms;
    }