Jump to content

Weekly update – 19 August 2022: New ProFields Table & Combo versions


ryan
 Share

Recommended Posts

I hope you are having a great week. Today I've released new versions of two ProcessWire ProFields modules: Table and Combo. In addition to various minor improvements and fixes, the biggest update in both is the addition of file and image fields. Since this is a fairly major feature addition for both modules, please consider these versions in a beta test stage for the moment. Both are available for download in the ProFields board now. 

Table v23

In ProFields Table both "file" and "image" column types were added. These are fairly basic file upload fields, but a major improvement over not having them at all. It can hold one file per column per row in the table. You can have as many file columns as you need per row. 

The front-end value of your file or image columns is one you are likely used to using already: Pagefile or Pageimage objects, just like they would be in a regular single-file or image field. This means your file/image values in your Table rows can benefit from many of the built-in methods you already use, such as the ability to present resized images, WebP variations, etc. 

When you configure a file column you can specify what extensions you want to allow and the maximum number of bytes you are willing for it to accept in an upload. When configuring an image column, you also gain settings to specify the thumbnail image preview size in both regular and HiDPI resolution. 

Combo v9

The update for Combo fields was similar to the Table field except that file and image fields go quite a bit further in Combo than they could in Table. Specifically, you get almost the full set of InputfieldFile/InputfieldImage configuration settings and features, including the ability to support both single and multi-file uploads, image actions, variations, focus control, description input, tags input and more. The only things missing relative to a regular File/Image field are the manual Crop action (Image field) and the ability to manage separate custom fields for each file or image.  

The front-end value for your Combo file fields is identical to what it would be on a regular ProcessWire File or Image field. Specifically a Pagefiles or Pageimages (plural) object if supporting multiple files, or a Pagefile or Pageimage (singular) object if supporting 1 file. To say it another way, you can use this exactly as you use other dedicated file/image fields in ProcessWire. 

Not yet included is the ability to query the properties of a file/image field from selectors, like when using $pages->find(). I'm still working on that part, but since I know most probably don't need that I decided to get this version out first and then continue working on that part. 

Core updates

The core updates this week were mostly minor, even if there were a lot of them. One of the ways that I stay up-to-speed on all the core code is to regularly read through all of it and make small adjustments along the way... anything that makes the code easier to read, or easier for PhpStorm to inspect it. You've seen these kinds of updates pretty much every week for years, but I hadn't thought to mention it before. This week there were more of these kinds of updates than usual so I just wanted to mention that what it's for. What sometimes looks like micro-optimization or minor code changes is usually just me staying fresh and up-to-date with the core. 🙂

That's all for this week. I hope you have a great weekend! 

  • Like 19
  • Thanks 3
Link to comment
Share on other sites

1 hour ago, Jan Romero said:

ProFields Table is the greatest

What kind of things are you doing with ProFields Table... I used it once... just for catalogue data entries, that's all.
Never really saw any real benefit using that module.

Is there something I missed?

  • Like 1
Link to comment
Share on other sites

37 minutes ago, wbmnfktr said:

What kind of things are you doing with ProFields Table... I used it once... just for catalogue data entries, that's all.
Never really saw any real benefit using that module.

Is there something I missed?

Works great as an alternative to repeaters. Way fewer pages. For example I use it on my ecommerce site to hold what items are in a person's cart. 

  • Like 6
Link to comment
Share on other sites

@wbmnfktr

Quote

Is there something I missed?

Consider the benefits of using a spreadsheet. The benefits of using a Table field are similar, and the data is all accessible, editable and searchable in PW. 

Table also has many of the benefits of repeaters, but without the overhead. It's much faster in terms of performance and much more efficient in terms of storage (1-1 mapping of input column to table column and input row to table row).

On the admin/input side, it's more like using a spreadsheet than a typical Inputfield, which can sometimes be preferable for editors. 

Table is also much more scalable than other repeatable types (like repeaters). You can have just a few rows or tens of thousands of them, something that you couldn't do with repeaters. Table can also paginate its rows, both input side and front-end. 

Personally, I use Table on almost every site I develop. One obvious use case I also come across regularly is rate tables like here (click on pricing tab, this is developed with Table). 

While table is much more scalable than Repeater, it is not as flexible or powerful as Repeater. But when your needs crossover with what Table does, it is certainly preferable. 

  • Like 1
Link to comment
Share on other sites

15 hours ago, wbmnfktr said:

What kind of things are you doing with ProFields Table... I used it once... just for catalogue data entries, that's all.
Never really saw any real benefit using that module.

Is there something I missed?

Granted, I don’t have much experience with the complex column types (I only just updated after 10 years or so, to get the Page type), but if you primarily use primitive types, ProFields Table has the benefit of being a single SQL join away. So if you’re like me and you sometimes want to do custom queries, that’s pretty cool. Plus, while I have nothing against repeaters, for some things it just feels icky to have the Page overhead.

I have a site with playlists, so there’s a table with Artist, Title and some auto-generated normalisation columns for search, for example. Another site manages ”trips“ using a column for the place and two DateTime columns for the duration.

I think the need to connect multiple Page references to some metadata like dates is pretty common, and ProFields Table is perfect for that.

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...