Jump to content

How have you solved the ability to offer column-style layout content creation?


Recommended Posts

I have a single RepeaterMatrix field that I'm using to generate a bunch of available components. Most of the remaining components left to create are intended for columnar-layout options...in this case, equal width 2-column, 3-column, and 4-column options, as well as a 30/70, and 70/30 split. Ultimately I'd prefer to offer just the column option, and leave the content of the columns up to the end-user, rather than locking it into a "1 image, 1 textarea" style option.

I'm having a hard time coming up with a way to offer the dynamic option, while also limiting the column count, and am curious how others might've tried solving this issue. It can't be all that unique!

EDIT:
Looks like I might (manually) recreate my RepeaterMatrix field and add it into a FieldsetOpen field along with a few settings (fields), such as a min/max number (2-4) and base the layout on that for the frontend. I don't need to force the columns to match the numbers of the column setting, the components would just flow into the number of columns as needed. Definitely not the most efficient, I'm sure, but it should work. It's too bad (at least without RockMigrations) that I can't easily create a duplicate of a RepeaterMatrix field! ?

Link to comment
Share on other sites

My difficulties were in understanding how to set up the fields to allow such a scenario, but not make it ridiculously complicated to maintain, or for the editing end-users.

I suppose offering a numerical value for the column size (ex: 2-10) per matrix item would also be a valid solution, and far more customizable. As silly as it sounds, the reason I was thinking of offering varied custom sizes is because some of our users are extremely tech-averse, and will mess that up. ?

Link to comment
Share on other sites

Actually I prefer custom sizes or labels instead of numeric sizes. It far more intuitive to have small/medium/large instead of 3/12, 4/12 or 6/12 for users.
In one of my projects I used numbers in combination with ion range slider (see screenshot). I don't like it anymore!

After that almost all of the projects I tried to avoid column layout options via backend. Just here and there a „smaller“ or “bigger“ checkbox.


 

Bildschirmfoto 2024-03-22 um 22.06.05.png

  • Like 1
Link to comment
Share on other sites

So far my solution to this seems unnecessarily complex.

I have a primary RepeaterMatrix field (`content_body`). I've duplicated that field and called it "content_column". I created a Repeater (standard) field, added a simple number field (for column width, for now) and the "content_column" field. I've added "content_row" to "content_body" as a new item.

I'm using field-based file rendering, so I have a file structure such as:

fields:
- content_body.php
- content_body/field1.php
- content_body/field2.php
...etc...

So now I've got to duplicate the files for rendering the contents of the "content_column" RepeaterMatrix, which is basically just a copy/paste of all the individual fields of the "content_body" folder, and maintain changes between the duplicated files.

I tried to add "content_body" to "content_row" as a subfield, but I kept getting 503 errors in the admin and ultimately had to revert the database to recover. ?

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...