Hi, there!

That's a great module you've accomplished to create. Simple idea, but very freeing.

Direct to the point: my layouts have the ID attribute set on the markup, which causes a duplicate of IDs on the page if I use the same layout on different frames or even if two layouts have same IDs on regions divs. Besides not being HTML compliant, it crashes many scripts in my site the make use of this IDs.

The solution is pretty simple: I need my layouts to be aware they are being rendered inside a frame, and know exactly which frame they are inside. As frames have unique machine names, that's the piece of text that should be attached to my region IDs.

To solve it, I've basically added a "current_frame" attribute to the display being rendered when inside the frame rendering loop. I've made sure to remove this dump attribute after we finished the renderings to not to leave a confusing attribute on the display. That was by far the easiest solution I found, but we could as well have it added to the variables in another form. I didn't go this direction because I would have to change quite many functions arguments and so on. My change looked much more unobtrusive.

See ya!

Comments

lucas.constantino’s picture

StatusFileSize
new978 bytes

Ops, had a little (big) mistake on the previous patch hehe.

helior’s picture

Status: Needs review » Fixed

Thanks Lucas! Sorry for the delay in response – I don't monitor Drupal.org issues as often as I used to.

In general, I'd advise against using IDs in your layouts since there could be multiple instances of that layout (like mini-panels, etc.) – but I understand your requirement to know which "frame" you are rendering in. Have you considered putting the "current_frame" value in the local $settings variable instead of $vars['display']? It could be namespaced with $settings['panels_frame'] and contain all sorts of context, plus we wouldn't have to unset it at every iteration.

I already merged your patch before I thought of this comment, so this is really more of a follow-up now :P But it would be great to not clutter the display object's property list if we can help it.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.