[Live] Method Name changes in ComponentWithFormTrait + expanded docs #967
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Using live components to render a dynamic form is turning out to be a very popular thing to do. The downside is that, in some ways, the form system doesn't "play well" when used so dynamically, which can cause confusion. In this PR:
A) In the docs, I've renamed the property that is bound to your form class to
initialFormData
to really emphasize that this is the ORIGINAL data used to create the form. It will not represent the new data until the form is submitted. I've also clarified this further in the docs.B) Updated the docs to talk more about
$this->formValues
and when data is and isn't updated during the lifecycle.C) Renamed some methods in
ComponentWithFormTrait
:getFormInstance()
->getForm()
andgetForm()
->getFormView()
. That's a BC break, and it's going to be annoying... which gives me hesitation. But these are currently named incorrectly (the reason goes back to an old version of live components to help name the variableform
in the template).Cheers!