This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hi,
I would like to change some values in my config_form.yaml
file (I access it internally). I don't know how to change the "name" value for example, or the "title" in "update" group.
I tried with extendFormFields
method in my controller, but it didn't work.
name: Volées
modelClass: XYZ\Ecole\Models\Volee
form: $/xyz/ecole/models/volee/fields.yaml
defaultRedirect: xyz/ecole/volees
create:
redirect: 'xyz/ecole/volees/update/:id'
redirectClose: xyz/ecole/volees
update:
title: 'Update'
redirect: xyz/ecole/volees
redirectClose: xyz/ecole/volees
Thank you very much for your help.
From your controller, you should be able to modify the form config with $this->formGetWidget()
$this->formGetWidget()->config['name'] = 'Something Else';
Hi Sam,
Thanks a lot for your reply. But I can't make it work in my controller. I get error Cannot use object of type stdClass as array
.
I tried to implement your solution in a formExtendFields($form) method :
public function formExtendFields($form)
{
$this->formGetWidget()->config['name'] = 'Something Else';
}
I also tried
$form->formGetWidget()->config['name'] = 'Something Else';
but got error "Call to undefined method Backend\Widgets\Form::formGetWidget()" on line 452 of C:\laragon\www\ompp-v2\vendor\october\rain\src\Extension\ExtendableTrait.php.
Where and how should I write your code to make it work ? Thanks a lot for your help !
I use a standard controller, made with de Buider plugin (FormController is implemented).
Regards, Jan
1-3 of 3