verbb / tablemaker

A user-definable table field type for Craft CMS
MIT License
40 stars 32 forks source link

Allow Craft native types for table columns #36

Closed danbrellis closed 9 months ago

danbrellis commented 1 year ago

What are you trying to do?

Currently the only type a cell can have is "singleline" text field. Craft's native table field offers a number of types, including Color, Date, Dropdown, etc. It would be great to include these types in the plugin so that content editors can make use of the validation and editting tools (eg color picker, date picker)

What's your proposed solution?

Adds a 4th column (after Width) to the "Table Columns" table with a type, similar to Craft's native table field editor.

Additional context

I have a fork that I will create a PR for and tag shortly.

danbrellis commented 1 year ago

PR #37 created.

@engram-design regarding our discussion from #25-

I'd love if you could look it over. I'm happy to work on it more if you'd like. I've used this on my own site pretty much exclusively for the Dropdown, so I'm not too sure about how all the other field types behave (I've done simple testing and gotten no errors but nothing rigorous).

engram-design commented 1 year ago

This is great, thanks for the PR! I'll give it a good look over.

rvgool-oym commented 1 year ago

Are there any updates whether or not we can expect this feature to be added?

engram-design commented 1 year ago

Just had the time to look over this properly, and looks good! Added for the next release. To get this early, run composer require verbb/tablemaker:"dev-craft-4 as 4.0.6".

JshGrn commented 1 year ago

Amazing, came here to suggest this and awesome!

Edit: I get a 500 after updating and viewing the page from the admin screen on a table which pre-existed before update

PHP Warning – [yii\base\ErrorException](https://www.yiiframework.com/doc-2.0/yii-base-errorexception.html)
Undefined array key "type"

Line 243 of  vendor/verbb/tablemaker/src/fields/TableMakerField.php

My previous comment said the type was missing from the Field Settings as I was expecting to be able to specify that the column would ALWAYS be a particular type, however I now realise from reading the previous PR's that it is an additional column. I do not have that additional column as I get the 500, this is due to having tables already existing in the site I would presume and therefore no type set.

I would imagine a quick fix for this would be defaulting to the single line type if its not set on the above line?

brianrivet-tilt commented 1 year ago

I've been trying out the beta and it is great. Is there any way we can get rich text or ckeditor/redactor as an option?

engram-design commented 1 year ago

@JshGrn Should be sorted with another composer require verbb/tablemaker:"dev-craft-4 as 4.0.6" command run.

@brianrivet-tilt It's not something I'm looking at, at the moment. Mostly because of the complexity with integrating with other plugins, if they're uninstalled what happens to their content and more. We're also trying to mimic the native Table field which doesn't suppose these fields (yet).

danbrellis commented 1 year ago

@brianrivet-tilt i know it's not the same but I've gotten some basic styling by just telling authors to add markdown and using craft's md twig filter when outputting.

engram-design commented 9 months ago

Updated in 4.0.8