Jump to content

Field output order on page


Recommended Posts

I am a bit lost, probably just because I do not exactly know what to look for.

I want to give an user the opportunity to change the order in which the fields of the template are rendered.

To keep it simple an easy example like to switch between the main text field, a slider and an image, so the user can chose freely which is on top, in the middle and at the end.

Of course I could just add some kind of number field to determine the order like "1 for on top, 2 for the middle and 3 for bottom", but this both ugly and not very intuitive. 

However, for some reason this feels like reinventing the wheel again because I can't imagine there are not more sophisticated methods, settings, options, whatever..., I plain may have overlooked so far.

Perhaps someone can point me into the right direction.

Link to comment
Share on other sites

I assume that you are talking about a user of the back end being able to change the order.

The nicest way that comes to mind would be to use the ProFields Repeater Matrix (a paid module), which would allow dragging fields into order.

Otherwise, I'd suggest a Page Reference or Select Options field to define the order of fields. You could use radio buttons with predefined field arrangements (e.g. 'main text / slider / image' , 'slider / main text / image', etc).

It might also be possible to use AsmSelect instead of radio buttons, with each value being a field, and with preselected or default values that include all fields. However, you'd probably want to omit the delete button on each item and the selection dropdown, which could get complicated (perhaps easiest using CSS).

Others may have better ideas!

Link to comment
Share on other sites

There also some (paid for) page builder modules that will do this (and more). I have my own page builder module which I might release for free, but which uses repeater matrix. So it looks like a choice between paying some money or writing some code. 

Link to comment
Share on other sites

  • 2 weeks later...

Just to append since this seems to be a rather common question (now knowing what I had to look for) and perhaps this may be useful for others.

I found a suitable and convenient solution for this by using InputfieldSelectize and "Multiple Sortable Options".

It's easy to add names for blocks/fields and make an output based on the given order ?

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

  • Recently Browsing   0 members

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