RobinMalfait / Laravel-auto-form-generator

Laravel automatic form generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Initial value for text inputs

adamriggsy opened this issue · comments

Currently, there is not a way (that I can see) to set an initial value on a text input. I have looked at the code and have inserted the following into the switch statement:

case 'text':
                        if ($this->getContentBefore($fieldName))
                            $data[] = $this->getContentBefore($fieldName);

                        if ($this->getSettings('showLabels')) {
                            $data[] = $this->form->label($fieldName, $this->getLabelText($fieldName) . ':');
                        }

                        if ($this->getSettings('types', $fieldName, 'value'))
                            $data[] = $this->form->input($type, $fieldName, $this->getSettings('types', $fieldName, 'value'), $extras);
                        else
                            $data[] = $this->form->input($type, $fieldName, null, $extras);

                        if ($this->getContentAfter($fieldName))
                            $data[] = $this->getContentAfter($fieldName);

                        break;

I don't want to add my code into your file in case of future updates. Is this something that can be added?