Parse new fields.
@param  array|Field|GroupInterface $fields
@param  string $name
@return GroupInterface|Field
763383
protected function parseFields($fields, $name) {
		if(is_array($fields)) {
			return new self(
				$fields,
				$name,
				(isset($this->data[$name]) ? $this->data[$name]:[]),
				$this
			);
		}
		elseif($fields instanceof Field) {
			$field = $fields;
			$field->setName($name);
			$field->setParent($this);

			if(isset($this->data[$name]))
				$field->setValue($this->data[$name]);

			return $field;
		}
		elseif($fields instanceof self) {
			$group = $fields;
			$group->setName($name);
			$group->setParent($this);
			$group->setData(
				(isset($this->data[$name]) ? $this->data[$name]:[])
			);

			return $group;
		}
	}
657561
public function parseField($fields){
        if(empty($fields)) {
            $fields    = array();
        }
        if(is_string($fields)) {
            $_fields    = explode(',',$fields);
            $fields     = array();
            foreach ($_fields as $f)
                $fields[$f] = true;
        }elseif(is_array($fields)) {
            $_fields    = $fields;
            $fields     = array();
            foreach ($_fields as $f=>$v) {
                if(is_numeric($f))
                    $fields[$v] = true;
                else
                    $fields[$f] = $v ? true : false;
            }
        }
        return $fields;
    }
596317
private function getFieldsWithName($name)
    {
        $trigFields = array();
        $fields = &$this->form->currentFields;
        if (isset($fields[$name])) {
            $trigFields[] = $fields[$name];
        } else {
            foreach ($fields as $f) {
                if ($f->attribs['name'] == $name) {
                    $trigFields[] = $f;
                }
            }
        }
        return $trigFields;
    }
1139127
public function groupBy($fields)
    {
        $fields = is_array($fields) ? $fields : func_get_args();
        $this->groupBy = array_merge($this->groupBy, $fields);
        return $this;
    }
553390
public function fields($fields)
    {
        $fields = is_array($fields) && func_num_args() === 1 ? $fields : func_get_args();
        $this->_parts['fields'] = Set::merge($this->_parts['fields'], $fields);
        return $this;
    }
1118546
public static function extractSwaggerDefinition($name, array $fields)
    {
        $definition = [
            $name => [
                "type" => "object",
                "properties" => [],
            ],
        ];
        foreach ($fields as $field => $info) {
            if(array_key_exists('type', $info) && in_array($info['type'], ['array', 'object'])) {
                $definition[$name]['properties'][$field] = $info;
            } elseif(array_key_exists('type', $info)) {
                list($type, $format) = self::translateSwaggerFormats($info['type']);
                $fieldData = [
                    "type" => $type,
                    "required" => $info['required'],
                ];
                if(array_key_exists('description', $info)) {
                    $fieldData['description'] = $info['description'];
                }
                if(array_key_exists('format', $info)) {
                    $fieldData['format'] = $info['format'];
                }
                $dto['properties'][$field] = $fieldData;
                $definition[$name]['properties'][$field] = $fieldData;
                if (strlen($format)) {
                    $definition[$name]['properties'][$field]['format'] = $format;
                }
            }
        }
        return $definition;
    }
759288
public function field($name) {
        $this->_fields['' . $name . ''] = new Field($name, $this->_name);

        return $this->_fields['' . $name . ''];
    }
302849
final function FieldMapper($name)
    {
        $fieldMappers = $this->FieldMappers();
        if (!array_key_exists($name, $fieldMappers))
            throw new \InvalidArgumentException($name . ' is not a field of ' . $this->TableName());
        
        return $fieldMappers[$name];
    }
795113
public function fields( $name )
    {
        if( $this->fields instanceof FieldCollection ) {
            $this->fields->field($name); //Sets active field
        }
        return $this->fields; // Is a direct access to the property
    }
343430
public function parse(string $name): Parse
    {
        if (isset($this->values[$name])) {
            return new Parse($this->values[$name]);
        }

        return new Parse(null);
    }
142132
private function getGroupIdByName(string $name)
    {
        if (!isset($this->groups)) {
            $this->resetCraftFieldsServiceGroupsCache();

            $this->groups = [];
            foreach (Craft::$app->fields->getAllGroups() as $group) {
                $this->groups[$group->name] = $group->id;
            }
        }
        if (!array_key_exists($name, $this->groups)) {
            $group = new FieldGroup(['name' => $name]);
            if (Craft::$app->fields->saveGroup($group)) {
                $this->groups[$name] = $group->id;
            } else {
                return Schematic::importError($group, $name);
            }
        }

        return $this->groups[$name];
    }
228264
public function registerGroup($name,$alias,$fields){
		$grp=new BConfigCategoryGroup();
		$grp->alias=$alias;
		$grp->name=$name;
		foreach($fields as $fld){
			$grp->fields[$fld->alias]=$fld;
			}
		$this->groups[$alias]=$grp;
		return $grp;
		}
419354
public function getField(string $name): FieldInterface
    {
        if (!$this->hasField($name)) {
            throw new DefinitionException("Field '$name' is not defined.");
        }

        return $this->fields[$name];
    }
322321
public function getField(string $name = '', string $group = 'default')
    {
        /** @var SectionInterface $section */
        $section = $this->groups[$group];

        $foundItems = array_filter($section->getItems(), function (FieldTypeInterface $item) use ($name) {
            return $name === $item->getBaseName();
        });

        return ! empty($foundItems) ? array_shift($foundItems) : [];
    }
117500
protected function objectifyFields($fields) {
        $new = array();
        foreach($fields as $name => $field) {
            if (is_object($field)) {
                $new[] = $field;
            } else {
                $new[] = new EntryField($name, $field);
            }
        }
        return $new;
    }
103220
public function addField($name, array $attributes)
    {
        //Argument 1 must be a string
        Argument::i()->test(1, 'string');
        
        $this->fields[$name] = $attributes;
        return $this;
    }
520021
public function getField( $name )
	{
		if( !$this->hasField( $name ) )
			return NULL;
		$values	= $this->getFieldsByName( $name );
		return array_shift( $values );
	}