Introduce hooks: render_before_loop_item/render_after_loop_item

In order to create some layouts with loops and conditional logic, while circumventing Bricks restrictions, it would be great to have a hook to add PHP before and after each query loop item.

I think the names could be

  • bricks/frontend/render_before_loop_item
  • bricks/frontend/render_after_loop_item

This should allow to wrap query loop items within HTML tags and give us much, much more flexibility, while Bricks UI stays restricted for query loops.

Okay, we can somehow get there with render_element as replacement and hook into every element and determine if it has the Bricks ID of the loop item.

But even after hours of trying to figure the workaround and writing the wrapping cod, which is not maintainable, I am not there.

do you have a design that you tried to build but failed ?
I am trying to think edge cases.

or just saving couple div wrapper ? :slight_smile:
if that is the case I understand.

image

It is necessary for the linked layout, except if Bricks removes the restriction of loops, which currently only allows a single root element, that is looped.

1 Like