-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version 9 #48
Merged
Merged
Version 9 #48
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Returns null if no autocomplete has been configured for the field.
- Add support for instructions position - Increased accessibility with aria-describedby and aria-label - Moved label, legend, and instructions into separate view - Add support for markdown in toggle inline label - Add wire:key to all foreach loops
This reverts commit fde78e0.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR features a major refactor of the codebase with many improvements and new features. There are some breaking changes that require your attention when upgrading.
What's new
FieldSynth
synthesizerBreaking changes
@formSections
,@formHoneypot
,@formSubmit
,@formErrors
and@formSuccess
blade directives with a global@formView
directive.hydratedFields
,submittingForm
,createdSubmission
, andsubmittedForm
hooks.submissionCreated
event.$HANDLE
,$VIEW
and$THEME
component properties.showLabel
field property.Upgrade Guide
This upgrade guide takes you through the breaking changes of this PR. If you made major customizations to the underlying Livewire form component, you might run into more breaking changes, as this PR features a complete rewrite of the codebase. Feel free to reach out if you encounter any breaking changes that are not listed below.
Themes and views
The theme directory and views have been restructured and optimized. The changes include Alpine for field conditions and general improvements of field views. I recommend you publish a temporary migration theme and view using the setup command, and adapt your existing views accordingly.
Renamed views
checkbox.blade.php
view has been renamed tocheckboxes.blade.php
input.blade.php
view has been renamed todefault.blade.php
file.blade.php
view has been renamed toassets.blade.php
Blade directives
The
@formSections
,@formHoneypot
,@formSubmit
,@formErrors
and@formSuccess
blade directives have been removed in favor of a new@formView
blade directive.label
propertyThe
label
property has been renamed todisplay
for consistency with Statamic's naming scheme. You should update your views accordingly.showLabel
propertyThe
showLabel
property has been removed. This change is reflected in the updated views.Form components
If you've got a custom form component, you should apply the following changes.
Extending component
The component namespace has changed. Update accordingly:
Component properties
The static component properties
$HANDLE
,$VIEW
, and$THEME
have been removed. You should mount the public properties instead:Hooks
hydratedFields
The
hydratedFields
hook has been removed. There are a couple of alternatives you can use instead.mountedFields
The
mountedFields
hook is called when the component is mounted. It is more efficient from a performance point of view as it is only called once. This hook is what you should be using most of the time.hydrateFields
The
hydrateFields
hook works similar to the deprecatedhydratedFields
hook. It is called every time the component is hydrated. This hook allows for dynamic updates to your fields on every request, at the expense of performance.submittingForm
,createdSubmission
,submittedForm
The
submittingForm
,createdSubmission
, andsubmittedForm
hook have been removed. Use theformSubmitted
hook instead.Events
The
submissionCreated
Livewire event has been removed. You should listen for theform-submitted
event instead.Field models
Field models have been substantially refactored. Each field now holds and processes its own value when the form is submitted.
$fields
public propertyPreviously, we used the public
$data
property for storing the data of a form. This property has been removed in favor of the$fields
property. This property contains all the field model classes with their properties and values.This change affects validation and custom messages. So you should update accordingly:
Validation in your form blueprints
Messages in your custom form components
Renamed model
You should update the checkboxes field model binding in
config/livewire-forms.php
:label
propertyThe
label
property has been renamed todisplay
. If you are programmatically setting this property, you should update your code accordingly.showLabel
propertyThe
showLabel
property has been removed. If your project relies on it, you may always add it back yourself.Property methods
If you are setting a field property in a form component or view, the value is now passed through and processed by the respective property method. If you've got your own models with custom property methods, you should update those methods to accept a value so it can be processed:
If a property method doesn't accept an argument, the property will be considered read-only.