aerni / statamic-livewire-forms

Supercharge your Statamic forms with Livewire
https://statamic.com/addons/aerni/livewire-forms
Other
28 stars 2 forks source link

Autoload custom components #18

Closed aerni closed 2 years ago

aerni commented 2 years ago

This PR adds the ability to dynamically load custom form components using the default {{ livewire:form }} component. Prior to this PR, you had to hard code custom form components like {{ livewire:contact-form }}, which wouldn't allow for dynamic loading in a replicator set like {{ livewire:form :handle="field:handle" }}.

Custom components are now loaded automatically if one exists. This happens by naming convention using the form's handle:

{{# This will load App\Http\Livewire\EventRegistrationForm #}}
{{ livewire:form handle="event_registration" }}