Even when no message is sent to drupal_set_message the pane_messages pane is outputted as an empty div:
<div class="panel-pane pane-pane-messages" >
<div class="pane-content">
</div>
</div>
I managed to hide it by returning null in the panels_everywhere_pane_messages_content_type_render function in pane_messages.inc (for debugging purposes):
function panels_everywhere_pane_messages_content_type_render($subtype, $conf, $panel_messagesrgs) {
$block = new stdClass();
$block->content = theme('pane_messages');
return NULL;
}
I tried making the return conditional and only return if $block->content was set but it doesn't work(it still outputs an empty div):
function panels_everywhere_pane_messages_content_type_render($subtype, $conf, $panel_messagesrgs) {
$block = new stdClass();
$block->content = theme('pane_messages');
return $block->content ? $block : NULL;
}
It would be nice to not clutter up the HTML code with a couple of extra divs when it's not needed..
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | panels_everywhere-pane-messages-empty-tabs-967690-8.patch | 477 bytes | jwilson3 |
Comments
Comment #1
merlinofchaos commentedTry giving it the "No style at all" style. You probably don't need pane markup around the messages anyway.
Comment #2
emattias commentedThe problem is I'm using a 960 grid theme which requires the wrapper divs with the correct classes (which I set in the pane settings) position it correctly in the grid when the messages are displayed. Is the style the problem?
Comment #3
merlinofchaos commentedWell, no, the style isn't the problem. I had just hoped that it was an easy way around the problem. I'm not sure what the actual problem is, honestly, as I haven't run into it. Would need to look more deeply. Generally, panes don't render if the content is actually empty, though sometimes having things that are invisible (empty markup, for example) will make Panels think it's not empty and render it anyway.
It shouldn't, normally, render things that are actually empty (i.e, $content is an empty string).
Comment #4
Letharion commentedSince returning NULL solves the problem, I'm guessing that Merlins guess is correct, and the problem is that there is "empty text" in the pane. As we don't want PE to add normally needless trims to everything, I'm closing this issue.
If you can reproduce this with a truly empty pane, please re-open.
Comment #5
dagomar commentedI noticed this too, I was able to remove the behaviour by removing empty lines from the output.
Comment #6
jwilson3There is an actual bug here. The pane messages in panels everywhere renders messages, tabs, action links, and help, if and when they are set.
However, I'm seeing a case of a page where there are no tabs, but the
<div class="tabs"></div>is still being printed out, hence the div.pane-pane-messages wrapper is being displayed on the page regardless of whether there are tabs or not.It looks like this issue is related to a change introduced a long time ago #1196710: local tasks are not rendered, where the rendering of the tabs was pushed off into the actual template, instead of in the preprocess (or process) function, like the other elements.
What happens is the line of code in
pane-messages.tpl.phpthat checks to ensure$tabsis not empty before rendering, will never be FALSE becausemenu_local_tabs()returns a renderable array, hence the empty<div class="tabs"></div>is displayed. In order to know if there aren't any actual tabs to display, we can either render them and check the result *or* check the internal structure of the renderable array.To prove this, just go to any page that doesn't have any tabs (e.g. a custom panel page).
The contents of $tabs when they are empty will be:
For what its worth, there is another related issue in the PE queue: #1678138: Render Action Links for Messages pane in preprocess.
If that gets in, and we can get a patch for this issue, then I think the problem of this pane randomly rendering even when it is empty will finally go away. I don't fully understand the circumstances of how the error happens in #1196710: local tasks are not rendered, but to avoid a regression, here are two options:
<?php print $tabs ?>in the template:Comment #7
jwilson3Here's a patch with option two, simply because its a one line change, instead of 3 lines across two files ;)
Comment #8
jwilson3Fixed the logic to actually work ;)
Comment #9
damienmckennaCommitted. Thanks jwilson3.