verbb / formie

The most user-friendly forms plugin for Craft CMS.
Other
93 stars 69 forks source link

Entries field - enable sorting entries by structure order #1960

Open steverowling opened 3 days ago

steverowling commented 3 days ago

What are you trying to do?

There doesn't appear to be an option to order entries in an Entries field by their structure position, only ascending or descending order of the custom fields, title, ID or created or modified dates.

Enabling ordering by structure order would permit end users to order the options in an entries field in a desired order independent of title, ID or creation date.

What's your proposed solution?

Add an option to Entries fields to order the entries in them by structure order (if they are in a structure section).

Additional context

No response

engram-design commented 3 days ago

I believe this is available for Categories fields, but it's tricky with Entries, because the sources you pick can be a mix of channels and structures. Somehow, it's got to figure out how to sort a Blog channel, and a Pages structure together, when there's no structure for a Blog for example.

Added for the next release, but you may get unexpected results if you start combining different sections. To get this early, run composer require verbb/formie:"dev-craft-4 as 2.1.20".

steverowling commented 3 days ago

Ah, it was Formie 3 that I was wanting this on. Please can you add it there as well, thanks!

I realise that it's only going to work if you pick a single structure section as a source, which is exactly my use case. To be fair, Formie already offers ascending and descending options for all custom fields defined in Craft, regardless of whether or not they exist in the selected sources for the Entries field. So there is already an onus on the user to make a sensible choice for the ordering, depending on what sources are chosen, so I don't think adding order by structure is much different.

engram-design commented 3 days ago

No problem, to get this early, run composer require verbb/formie:"dev-craft-5 as 3.0.0-beta.16".