These formtools can be useful for expanding your backend forms with the
functionality they provide. Just drop this repository in your plugins directory
or install it via the backend plugin manager in your OctoberCMS installation.
If you wish to run the PhpUnit tests to verify if everything works after working
on a pull request, make sure you run it on a version of October that has the
./tests directory(a composer install or a git clone).
To run the PHPUnit tests browse to this directory and execute ../../../vendor/bin/phpunit
Current features of this OctoberCMS plugin:
-
Colorpicker
A simple color picker that allows the selection of an RGBA color and that is
stored in text format: rgba(164, 194, 244, 0.43)
usage
type: tsch_color_picker
-
Filtered Checkbox List
Just like the original checkboxlist and the code is also based Octobers checkboxlist element.
It only adds a search functionality through the options and a way to hide unselected items or selected items.
usage
type: tsch_filtered_checkboxlist
The Form Tools widgets can be used in the following ways:
Color Picker
The default October picker providers a hexadecimal color code. For many purposes that is enough, but when you need RGBA values, this color picker comes to the rescue.
Usage
In a form configuration you can implement it in the following way:
background_color: type: tsch_color_picker label: Select background color
Configuration
There are no other than the default form widget configuration options available for the color picker.
Return value
The values will be returned as a string to the model. Make sure you have a string field of sufficient length to store a string like rgba(0, 255, 255, 0.62)
Filtered checkbox list
Basically the same as the default octobercms checkbox list.
Provide a function to get the options as described in the documentation.
Usage
food_toppings: type: tsch_filtered_checkboxlist public function getFoodToppingsOptions() { return [ 'c' => 'author.plugin::lang.toppings.cheese', 'p' => 'peperoni', 'd' => 'Dolphins', ]; } food_toppings: type: tsch_filtered_checkboxlist options: c: author.plugin::lang.toppings.cheese p: peperoni d: Dolphins
You can use language file keys for translateable field option descriptions.
Configuration
There are no other than the default form widget configuration options available for the color picker.
Return value
It returns an array of the selected items.
-
Valentin
Found the plugin useful on 16 Jan, 2021
- Open your database
- find tschallacka_formtools_form_tools_demos table
- edit color column
- change length of the column OR change type from "varchar" to "text" and delete length
-
O. Villani
Found the plugin not useful on 15 Nov, 2020
Hi,
unfortunately I get an error text while installing:
Update failed
"SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'color' at row 1 (SQL: insert into
tschallacka_formtools_form_tools_demos
(id
,created_at
,updated_at
,name
,options
,color
) values (1, 2019-01-01 12:00:00, 2019-01-01 12:00:00, test, [1,2,3], rgba(119, 54, 54, 0.41)))" on line 664 of /home/ovillani-admin/webs/tomUser/vendor/laravel/framework/src/Illuminate/Database/Connection.phpAny ideas?
-
1.0.3 |
Updated color code so it can accept rgba codes Jan 17, 2021 |
---|---|
1.0.2 |
Adding filtered checkbox list and demo page for the form elements. see /backend/tschallacka/formtools/formtoolsdemo Mar 26, 2019 |
1.0.1 |
First version of FormTools Apr 19, 2017 |
Nothing to do, just add the plugin to your project and the form widgets should be available to you to use in form configurations.
As of version 1.0.2 there is now a demo controller with a demo model that display several implementations of the form widgets.
To visit the demo browse to /backend/tschallacka/formtools/formtoolsdemo
on your server.