Download the PHP package hashandsalt/kirby3-forms without Composer
On this page you can find all versions of the php package hashandsalt/kirby3-forms. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package kirby3-forms
Kirby 3 Forms
A small plugin for creating HTML forms more easily. Mixing HTML with PHP is quite unreadable, and this approach has the bonus of being to offload logic to the controller if necessary - this is convenient for things like select field where you might want to loop over a structure field to populate the option list.
Installation
Manual
To use this plugin, place all the files in site/plugins/kirby3-forms
.
Composer
Commercial Usage
This plugin is free but if you use it in a commercial project please consider to
Usage
The plugin contains a number of functions to make it easier to create form elements, matching labels, and error messages.
Input Function
Accepts an HTML input type, name, css ID, css class, and an array of all other HTML attributes needed.
Working example:
Label Function
Accepts label text, for attribute, and css class.
Working example:
Textarea Function
Accepts name, for attribute, and css class.
Select Function
Generates an html select element.
Accepts name, css ID, css Class, Html Attribute array, default selection (optional), option to select by default (optional).
Basic use:
With an option pre-selected:
With an option pre-selected and additional HTML attributes:
Buttons
Accepts type, name, css ID, css Class, text string, and an array of HTML attributes:
Working Example:
Radios & Checkboxes
The input function can also be used for radio and checkbox elements:
Error / Success Messages
Accepts html tag, message string and css class
Working example:
Snippets
The plugin contains a few snippets to match the functions above, so you can use as is or use a starting point to make your own.