kristijanhusak/laravel-form-builder

[Proposal] Public API object oriented

Open

#488 opened on Feb 18, 2019

 (1 comment) (3 reactions) (1 assignee)PHP (305 forks)github user discovery
enhancementhelp wanted

Repository metrics

Stars
 (1,715 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Currently auto completion is missing due to the use of arrays inside most methods. Are you by any chance looking into making a change to make the project more object oriented?

e.g.

$textField = new TextField('field_name', 'field_id');
$textField->addLabel('This is a label for the text field')
        ->addClass('form-control')
        ->value($prefillValue);
 
$this->add($textField);
 
$selectField = new SelectField('select_name', 'select_id');
$selectField->addChoice('en', 'English')
            ->addChoice('fr', 'French')
            ->addLabel('Select field label')
            ->setMultiple(true)
 
$this->add($selectField);

Contributor guide