Greetings:

I have a custom panel layout that is responsive, and it nicely adjusts based on whether there is any panels content within a given region.

However, this layout is being rendered inside of my regular theme, with a standard sidebar_left region that displays regular old Drupal blocks.

I am trying to find the right preprocess function that will allow me to let my panels layout know whether sidebar_left is empty, so that I can adjust my grid and go to 100% width. I've tried all of the obvious candidates (I think) -- for example:

function omega_eps_preprocess_page(&$variables) {
  if (empty($variables['page']['sidebar_first'])) {
    $variables['sb'] = 'no sidebar';
  } else {
    $variables['sb'] = 'sidebar';
  }
}

but I can't find a way to pass this on to eps-grid.tpl.php (which is my custom panel layout living within my theme).

Any pointers would be much appreciated as to whether this is even possible, and if so, where I should be looking.

Thanks!

Comments

merlinofchaos’s picture

The layout is processed before the page template is, so you can't pass it on because you'd have to pass into history. :(

You'd have to, in your layout template, look ahead and examine what's in the region and I"m not precisely sure how to do that.

broeker’s picture

Sounds good, I will keep trying. And, yes, I'm the guy who grabbed you after your awesome talk in Denver to ask this very question (where you gave the same basic answer, except for that part about how the Merlin himself isn't precisely sure how to approach lol). Thanks again for the ridiculous amount of work you do, and if anybody else can help brainstorm how this might work I'm all ears. Otherwise it sounds like a case for Panels Everywhere.

merlinofchaos’s picture

Even with PE you've got an ordering problem, unless you actually just promote most of it to a site template specifically for that page (which you can do). I'm not sure you really want to, though.

nagiek’s picture

Broeker, I'm trying to do a the same thing. I'm writing my own Panels renderer plugin to add content if it detects the region is empty.

Did you try the same approach?

broeker’s picture

I have not yet had a chance to revisit, but if you get anything working that would be great. I hope to revisit this soon.

nagiek’s picture

StatusFileSize
new3.75 KB
new836 bytes

I'll show you what I wrote. I'm not sure if this exactly meets what you want. It detects empty areas within the panels context...

There's no UI, but it's working for me.