Jump to content
ryan

PW 3.0.139 – Core updates

Recommended Posts

This latest version of ProcessWire on the dev branch adds a new Inputfield module called “Toggle” that is an alternative to the existing Checkbox Inputfield. It also adds a nicer way to make column width adjustments to your fields when editing a template. This post covers all the details with screenshots and a short video:

https://processwire.com/blog/posts/pw-3.0.139/

  • Like 23

Share this post


Link to post
Share on other sites

👍 for the width adjustment, this is a really nice feature that makes setting up new templates and changing them much more convenient!

Funnily, I just implemented a toggle inputfield myself and thought, oh bummer, I could have saved myself the work! Turns out, you weren't talking about a sliding toggle like I am working on, and the core toggle field type is a nice addition for cases where the choices need to be more verbose than a simple yes/no and on/off. It'll come in handy for some of the forms I have in the queue.

I will have to rename my module, though 🙂 It'll be CSS only. I still need to add color and size options, and it'll hopefully hit the module repo at the end of next week.

  • Like 9

Share this post


Link to post
Share on other sites
On 8/30/2019 at 11:46 PM, tpr said:

Yeah, I feel like the new core addition could show the layout of the fields like your Robin's does. I guess the issue could be with not having enough room to show the field label, name, type and width, but maybe there is a solution that would work.

  • Like 1

Share this post


Link to post
Share on other sites

It's not my module but @Robin S's, just to make it clear :)

  • Like 2

Share this post


Link to post
Share on other sites

I'm trying to understand what are the differences between toggle and select options (with radio input of course) 🤔

Share this post


Link to post
Share on other sites

Some details were written down here: https://processwire.com/blog/posts/pw-3.0.139/#new-toggle-field

This is some kind of feature you have to use, need or want to fully understand this fieldtype.

I actually love to have such a field - but haven't played with it yet unfortunately - as it will probably save me tons of time and make things easier in the future. I will use it for conditional settings in my templates - I guess. At least I needed this kind of possibility in the past and now it's here.

 

Share this post


Link to post
Share on other sites
On 8/31/2019 at 7:48 AM, BitPoet said:

Funnily, I just implemented a toggle inputfield myself and thought, oh bummer, I could have saved myself the work! Turns out, you weren't talking about a sliding toggle like I am working on, and the core toggle field type is a nice addition for cases where the choices need to be more verbose than a simple yes/no and on/off. It'll come in handy for some of the forms I have in the queue.

I will have to rename my module, though 🙂 It'll be CSS only. I still need to add color and size options, and it'll hopefully hit the module repo at the end of next week.

Unfortunately, I didn't have enough time to really brush up the module, but I have nontheless pushed it to GitHub and created a topic for my SlidingToggle Inputfield (and Fieldtype) in the modules section.

Share this post


Link to post
Share on other sites

Hi @ryan,

the toggle addition sounds really nice.

I just set it up with the "integer" option and I can echo the values 0 and 1 for every item in the array correctly. However, when accessing the toggle (named "toggle_katalog") inside a selector, such as 

$products = $productFolder->children("sort=title, toggle_katalog=1");

I get zero matches. But there are actually hundreds of items with a value of 1.

Am I missing something? I'm using PW 3.0.147.

Thanks and best
Nils

Share this post


Link to post
Share on other sites

Addition: It turns out that pre-selection doesn't work here in combination with selectors.

What I did: I chose a "Default Selected Option" and made the field required. When editing the page, the selected default option is highlighted correctly in the UI and I can echo the values in the frontend – but when using selectors, the value is not considered.

If I change the value of the toggle when editing a page, hit save and change it again + save, it works with selectors.

Is there an approach to make it work with pre-selection? That would be important in my case.

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...