Imagine you have a flexible layout with 2 regions in the top row, three regions in middle row and 2 regions in bottom row. Now you realise you need to add a single, full width region between the top row and the middle row..

Maybe i am missing something but all i can to is "add row to bottom" or "add row to top". This is highly annoying, because if i want my single region row to be placed where i want, i have to create it at the bottom, delete all the regions and rows above it and then recreate those rows/regions under...

Isn't there a way to "add a row between" two given rows? That would make layout design much quicker.. especially when trying out different layouts to see what works best.

Hope my description wasn't too confusing!

Simon

Comments

simonswiss’s picture

Title: Add row between - Flexible layout » Add row "between" - Flexible layout
merlinofchaos’s picture

Doing this is actually fairly difficult from a UI perspective because once you say between, you now have to say between what, which means there needs to be a way of selecting which location to insert it into. Tricky.

merlinofchaos’s picture

Category: support » feature

Changing status.

benanne’s picture

subscribing, this is biting me pretty hard at the moment because I already used the existing panel names in my stylesheet, and they will all change after I add a new row in the middle of the page.

billypea’s picture

re; merlinofchaos:
"Doing this is actually fairly difficult from a UI perspective because once you say between, you now have to say between what, which means there needs to be a way of selecting which location to insert it into. Tricky."

How about if, once a new row was added to the top or bottom, that row could then be moved up or down between the other rows? Either by clicking "Move Up" and "Move Down" buttons, or in a fashion similar to how Blocks lets you reorder blocks, or how Views lets you reorder fields.

Panels is great and I'm sure it'd be completely insane to add this functionality, but this way you might not have say 'between what' and could just say 'after the next one'.

Vote_Sizing_Steve’s picture

How about adding a row to the bottom, but allowing that row to then be moved up?

awolfey’s picture

Version: 6.x-3.2 » 6.x-3.7
Assigned: Unassigned » awolfey
Status: Active » Needs work
StatusFileSize
new4.58 KB

Here is a patch that lets you choose where to position a new row.

Left to do:

- Update the settings form and submit to rearranage the rows when editing an existing row's settings.
- Clean up code / efficiency.

I may have some more time for this, but here's a start for anyone with interest.

yesct’s picture

subscribe

I wanted to do that. add a new row top or bottom is fine, but then I need to be able to move it up or down...

rtsang’s picture

What if we add a menu item "Insert a row region" under each "Row" menu? The row should know it's current row number and where to put the new region.

joinso’s picture

Hi!

Anyone use the patch?

We apply the patch and we can set the row position, but the rows doesn't move to their position setting after we save it.

Any idea?

Regards!

joinso’s picture

Hi!

I find new information.
When you change the values for row position, the changes are not comitted.....
Any idea?

Regards!

raincloud’s picture

I found this patch for version 3.7 - does it mean it was fixed in 3.9 ? (but I have upgraded to version 3.9 of panels but can't see any new way to insert row between existing rows). I don't know how to apply the patch.

merlinofchaos’s picture

No, it's marked 'needs work' meaning it isn't in a state that can be committed. The person who posted the patch did not have time to complete the work, so a developer is needed to get this code good enough to be committed.

Since flexible.inc is pretty bad code to begin with, that really just means make sure it works and does everything it needs and won't cause problems.

awolfey’s picture

I'm about to start another project where this may come in handy, so there's some chance I can pick it back up.

khiminrm’s picture

Subscribe. This feature for this great module would be a very usefull. Need this feature for Drupal 7.

perhenrik’s picture

Is there any progress on this? Or is there any workaround that allow the addition of rows or regions without renaming all others? I know this is old, and for D6, but Isn't this an isssue for D7 as well?

marktheshark’s picture

+1

Is there any way to insert a row in the middle of an existing layout without having to start over?

tomas.teicher’s picture

Issue summary: View changes

Same problem in D7

MTecknology’s picture

Version: 6.x-3.7 » 7.x-3.4

Still an issue in D7. Updating last version tested with.

Rakesh Acharya’s picture

It's very hard and time consuming to recreate a whole layout for adding a row in between ... please find a solution for this

maartendeblock’s picture

A workaround is creating a row at the bottom and then exporting the variant.

Pretty high up you will see something like this:

    'main' => array(
      'type' => 'column',
      'width' => 100,
      'width_type' => '%',
      'children' => array(
        0 => 'main-row',
        1 => 1,
        2 => 14,
        3 => 10,
        4 => 11,
        5 => 12,
        6 => 13,
      ),
      'parent' => 'canvas',
    ),

The children are the rows, move the last row up to the desired position:

    'main' => array(
      'type' => 'column',
      'width' => 100,
      'width_type' => '%',
      'children' => array(
        0 => 'main-row',
        1 => 1,
        2 => 13,
        3 => 14,
        4 => 10,
        5 => 11,
        6 => 12,
      ),
      'parent' => 'canvas',
    ),

Make sure you update the number!

Copy the alle the code and click 'Import variant' on top and past the code. A new variant will be created with your row on the correct position.

Delete (or disable to be safe) the old variant.

dman’s picture

Thanks for the tip on re-arranging things with an export @maartendeblock.
I was also able to proof-read a bunch of settings to fix a bunch of things, and re-machine-name things more consistently by editing the array that with the UI.
Altogether a win.

truyenle’s picture

+subscribe for drupal 7

jsimonis’s picture

I guess I'll have to try out the export way of doing it. This has been a huge hassle for a site that is under development. Where the rows are placed has been changed multiple times. Which means that I have to kill a bunch of rows and completely recreate them since there is no ability to just move row 5 up to row 2, for instance.

michael2hands’s picture

Hey there,

My company needed this feature, so I worked on it. I uploaded a patch - it is unrefined, but works for us and our needs.

What I did was take up where awolfey left off on their "rung" position concept and uploaded my own patch file. It adds a 'rung' property to flexible layout plugin so that user can set/edit the order that rows appear within a column in Admin Layout designer.

The next step will be to make the UI draggable, like how regions are draggable when Layout designer is hidden.

Best,
Michael Fuery

Basic usage is:

  1. Navigate to a published Basic Page -> Customize Display -> Content.
  2. Click "Show layout designer".
  3. Do each of the following. For each of these scenarios, observe layout of rows is in correct order, all content regions are present (or not present in the case of removing a row) in Admin and on Webpage. Also, ensure the "Row Position" property of each row is correct.
    1. Adding a row
      1. Click a "Column" -> Add row.
      2. Set "Row Position". Click Save.
      3. Click "Row" dropdown for the row you just created and select "Add region".
      4. Select a piece of content to add. Click Save.
      5. Click Save again.
      6. Observe layout of rows is in correct order in Admin and on Webpage.
    2. Editing a row
      1. Click on a "Row" -> Row Settings.
      2. Adjust Row position. Click Save.
      3. Click Save again.
    3. Removing a region
      1. Remove all rows from a region.
      2. Click "Region" -> Remove region.
      3. Click Save.
michael2hands’s picture

StatusFileSize
new16.17 KB
michael2hands’s picture

Status: Needs work » Needs review

I hope the community will review and comment on the patch. Thank you! :)

awolfey’s picture

Assigned: awolfey » Unassigned

Unassigning myself after all the years...

michael2hands’s picture

StatusFileSize
new15.39 KB

Needed to fix so works with layouts with more than one column.

michael2hands’s picture

Version: 7.x-3.4 » 7.x-3.5
StatusFileSize
new13.25 KB

NOTE this is for an older version of panels: 7.x-3.5 - It would be easy to convert to latest 7.x version, let me know if anyone would like that.
Changes:
- Added a hook for panels_flexible_render_item_alter()

scottfalkingham’s picture

Version: 7.x-3.5 » 7.x-3.9
StatusFileSize
new11.56 KB

Hi Folks,

Building off michael2hands's latest patch. This patch:

- Updates to 7.x-3.9.
- Fixes a couple bugs that insert/move rows to wrong positions.
- Rearrange row positions after editing an existing row's settings without requiring to save the panel.

scottfalkingham’s picture

Hi Folks,

Building off michael2hands's latest patch.

Patch 31:
- Updates to 7.x-3.9.
- Fixes a couple bugs that insert/move rows to wrong positions.
- Rearrange row positions after editing an existing row's settings without requiring to save the panel.

joshf’s picture

A slightly smaller patch was added by @scottfalkingham but I'm unclear as to what it does. The filename ends with -31 but there's no accompanying comment.

joshf’s picture

StatusFileSize
new13.08 KB

This is an update of the patch from #30 which makes the diff relative to the module directory instead of the site root.

joshf’s picture

Version: 7.x-3.9 » 7.x-3.x-dev
StatusFileSize
new10.81 KB

This is a reroll of #30 that applies cleanly to 7.x-3.9.

avpaderno’s picture

I re-published the comments from scottfalkingham, unpublished from the antispam module used on Drupal.org. (In this case, it was a false positive.)

vipul tulse’s picture

Assigned: Unassigned » vipul tulse
vipul tulse’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new31.92 KB
new18.65 KB
new21.04 KB

Patch #30 by scottfalkingham working fine.

After applying the patch it removes add row bottom and top from the list and adds an option to row with add row popup it provides row position dropdown which that you can set your new row position/ if edit it moves the row, working fine in my proect

vipul tulse’s picture

Assigned: vipul tulse » Unassigned
joelpittet’s picture

Status: Reviewed & tested by the community » Needs work

There is a bunch of dsm() lines in the patch, I'm not sure it's done yet?

narendra.rajwar27’s picture

Assigned: Unassigned » narendra.rajwar27
narendra.rajwar27’s picture

Assigned: narendra.rajwar27 » Unassigned
Status: Needs work » Reviewed & tested by the community

@joelpittet, Patches are listed after IS section, in Ascending order of comment. The patch does not include dsm() function now. Please have a look.

Thanks

joelpittet’s picture

Whoa, that's not typical, thanks @narendra.rajwar27 the order is usually the other way and that threw me for a loop, normally the IS patches are in descending order.

joelpittet’s picture

Assuming #35 is the RTBC'd patch? I've hidden the rest and reordered them

joelpittet’s picture

Actually so people don't spend too much time on this... I don't plan on committing this as it could be quite disruptive of a change and since I'd prefer to encourage people to move to Drupal 8 I'll be avoiding committing D7 patches that are feature requests(some other maintainer may be more bold than I, but that's my stance).

jsimonis’s picture

Unfortunately there are still too many needed modules that aren't ready in D8. So many of us are stuck in D7 for quite some time. Hence why the big push to D8 has been moved back. I'd love to have all my sites on D8 right now, but unfortunately it's not possible.

japerry’s picture

Status: Reviewed & tested by the community » Closed (outdated)

Drupal 7 is no longer supported, closing.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.