src/User/UserField.php
public function add($field, SectionInterface $section = null): UserFieldContract
    {
        if ($field instanceof SectionInterface) {
            $section = $field;

            if ($section->hasItems()) {
                foreach ($section->getItems() as $item) {
                    /** @var FieldTypeInterface $item */
                    $item->setOptions([
                        'group' => $section->getId()
                    ]);

                    $this->add($item, $section);
                }
            }

            return $this;
        }

        // Setup field options
        $field->setTheme('themosis.users');
        $field->setPrefix($this->options['prefix']);

        $this->repository->addField($field, $this->getSection($field, $section));

        return $this;
    }
public function add($field, SectionInterface $section = null): UserFieldContract
    {
        if ($field instanceof SectionInterface) {
            $section = $field;

            if ($section->hasItems()) {
                foreach ($section->getItems() as $item) {
                    /** @var FieldTypeInterface $item */
                    $item->setOptions([
                        'group' => $section->getId()
                    ]);

                    $this->add($item, $section);
                }
            }

            return $this;
        }

        // Setup field options
        $field->setTheme('themosis.users');
        $field->setPrefix($this->options['prefix']);

        $this->repository->addField($field, $this->getSection($field, $section));

        return $this;
    }
public function add ( $ field , SectionInterface $ section = null ) : UserFieldContract { if ( $ field instanceof SectionInterface ) { $ section = $ field ; if ( $ section -> hasItems ( ) ) { foreach ( $ section -> getItems ( ) as $ item ) { /** @var FieldTypeInterface $item */ $ item -> setOptions ( [ 'group' => $ section -> getId ( ) ] ) ; $ this -> add ( $ item , $ section ) ; } } return $ this ; } // Setup field options $ field -> setTheme ( 'themosis.users' ) ; $ field -> setPrefix ( $ this -> options [ 'prefix' ] ) ; $ this -> repository -> addField ( $ field , $ this -> getSection ( $ field , $ section ) ) ; return $ this ; }
Add a user field.

@param \Themosis\Forms\Contracts\FieldTypeInterface|SectionInterface $field
@param SectionInterface|null                                         $section

@return UserFieldContract
Add a user field .