I've inserted a mini panel into a panel page, but when the mini panel is empty (i.e. the fields it displays are all empty), it's still displayed on the panel page (or at least its heading is).

I believe this to be a bug, as it just looks wrong, but feel free to correct me if that's not right.

Please see follow-up issues:
* #1367154: Empty mini-panels does not hide when title being overridden.
* #1391450: Panels does not hide an empty mini panel (the fix is in comment #16)

Comments

davidcgutman’s picture

I probably should create a separate issue for it, but I'm guessing it's related. This is true for a normal panel as well if you include a view block as content - it will show up as an empty pane even if the view returns no fields. The "User Login" block disappears as it should when the user is logged in though...

BWPanda’s picture

Title: Mini panels still displays when empty » Hide panels/panes when empty
Version: 6.x-2.0-alpha3 » 6.x-3.x-dev
Component: Mini panels » Code
Category: bug » feature

Making this a feature request instead.

merlinofchaos’s picture

Title: Hide panels/panes when empty » Hide mini panels when empty

Most panes do hide themselves when empty. It's possible either that 1) mini panels do not, or more likely, 2) the mini panel isn't truly empty. Sometimes things can apepar empty, but still have markup in them, and that markup appears to the code.

EvanDonovan’s picture

Mini-panels hide themselves when empty unless there is markup in them. I have noticed that this problem happens especially when you create a tabbed mini-panel using the Tabs Panel Style. The views have markup in them even if they are empty. Thus, the title will still show. Any solution for this would be appreciated.

Tarsjusz’s picture

Don't know if writing this in proper place:

After upgrading to panels 3.1 from 3.0 panels containing empty views are not hiden any more. There is no footer nor header in this views. Simply look at http://tarsjusz.pl/person/krzysztof-spalik , panel with title ,,Koordynuje:'' is an empty view and was not displayed until upgrade.

Any help would be highly appreciated, as the only solution I know is to downgrade.

brianmercer’s picture

I extracted the panels-pane.tpl.php file from the 6.x-3.x-dev version of Panels and put it in my theme directory initially in order to make the heading changes I wanted.

I also had panes appearing without content. If their title was empty (and probably not using the rounded corner style) they were invisible, but since I had some padding attached, they would mess up my layout. So I wrapped the tpl in an if statement like this:

<?php if (!empty($content)): ?>
<div class="<?php print $classes; ?>" <?php print $id; ?>>

...

</div>
<?php endif; ?>

and that solved my problem for now.

ShaneOnABike’s picture

I also noticed that adding a 'filegroup' to a minipanel isn't being hidden properly. Inside my minipanel I have four File_field CCK types (Image, File, Media, and Link). Normally, these are hidden on nodes if they are empty but for some reason there seems to be a bug in panels that isn't hiding these properly.

I created some code to try and resolve this and hide the content when empty. It would be great if we could resolve this issue for the next release.

$class = $contexts['requiredcontext_node_1']->data;

// Obtain the file field arrays
$file = $class->field_file_file;
$image = $class->field_file_image;
$media = $class->field_file_media;
$link = $class->field_links;
$linkurl = $link[0];

// Test the arrays
$linktest = !empty($linkurl['url']);
$imagetest = !empty($image[0]);
$mediatest = !empty($media[0]);
$filetest = !empty($file[0]);

return ($filetest || $imagetest || $mediatest || $linktest);
Doomd’s picture

I have a mini-panel block that contains 4 views blocks. When those views blocks are empty, I'd like the whole mini-panels block to hide as well.

merlinofchaos’s picture

I don't think that's possible, because there's no way to have the entire display hide if all of the content panes within it are empty.

sdboyer’s picture

Status: Active » Closed (won't fix)

Confirming that, merlin - just went through the mini-panel code again for a sort-of-related issue. Would require a fairly painful rewrite, unfortunately.

merlinofchaos’s picture

Status: Closed (won't fix) » Active

Re-opening. With the new render pipeline, I think this is much more possible now. We could slide a check into panels_renderer_standard::render_layout() and set a flag on the display (or renderer) to abort the rendering if there is no rendered content at all.

EvanDonovan’s picture

I actually transitioned away from tabs panels style to quicktabs due to this bug, so it would be cool if it were fixed.

merlinofchaos’s picture

I really hesitate to call it a bug.

glennnz’s picture

@merlin

Earl, from here -> http://drupal.org/node/216076#comment-3337056

Do you have a timeline for #11?

Not trying to be pushy, but this would be pretty cool ;-)

Cheers

Glenn

Agileware’s picture

Subscribing

HnLn’s picture

sub

bryancasler’s picture

subscribe for a D7 solution

held69’s picture

subscribing

mansspams’s picture

subscribing

jruberto’s picture

will probably dig into a .tpl.php based solution to meet immediate needs (and will share if i come up with something viable / portable), but subscribing in case the silver bullet appears...

HnLn’s picture

I still get this (D7 alpha 3 en dev) with standard view panes (the panel is a single view pane), the mini panel renders and the content is

(so no view classes or divs). So this shouldn't be a feature request but a bug ?

In this case I fixed by putting the default onecol tpl inside "if ($content['middle']):", which appearently renders although it's empty.

Letharion’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
Status: Active » Postponed (maintainer needs more info)
Issue tags: -panels, -cck filefield, -hide or show, -mini panels

As Merlin states in #3, panes normally do hide themselves, as such this can't really be a feature request. As far as I can tell in the issue, no-one has actually shown an example of a truly empty pane that still renders, so it's not a bug report either.

#8 - #11, are as far as I can tell about a related but different issue, which is how to handle several blocks within a minipanel. That seems to be like it should be a separate issue.

R.Hendel’s picture

Status: Postponed (maintainer needs more info) » Active

I made a simple test to investigate behaviour of panels/minipanels:

You have a minipanel inside of a "normal" panel - e.g. using panels everywhere in site-template.
When you either override a title for pane in site-template which contains that minipanel, or when you override a title for the minipanel itself, then for panels this is not empty, even when minipanels content is empty.

  • In both cases panels displays an "empty" box with one of those titles.
  • When you leave both titles empty then it is empty for panels and no minipanel will be displayed.

Now you can disuss, if this behaviour is what you expect. ;-)

We have currently a usecase, in which we want to setup a title for the pane which contains minipanel.
Given that minipanel has no content we want drupal to hide this pane. Our solutions is hiding it via js. Not the best way, but it is ok as a workaround...

bryancasler’s picture

R.Hendel could you share the JS you're using?

dasRicardo’s picture

Hello,

Below the piece of code in question
In case the mini-panel is empty JS is hiding it.

$('.pane-panels-mini').each(function() {
          if($('ul', this).length == 0) {
            $(this).hide();
          }
});

This works only when you use the Tab-Layout in your mini-panels. The Script loops every element with class 'pane-panels-mini' and it tests if a <ul> is inside. If not, the script hides the element.

The <ul> is the container for the tabs, in case mini-panel have no content to render, it doesn't build tabs resulting in the fact that no <ul> is inside.

With some little changes you can use it also without Tabs. My proposition is: You test if the <div> with class 'inner' inside the mini-panel is empty and if so you just hide it.

I hope this solves your problem.

Letharion’s picture

Status: Active » Closed (won't fix)

@R.hendel Thanks for clearly describing the problem. Again, this issue contains to many loose ends. New issue based on #23 here: #1367154: Empty mini-panels does not hide when title being overridden.. Closing this one, hoping I can get rid of it.

bryancasler’s picture

Doing a follow up here with specific instructions to reproduce #1391450: Panels does not hide an empty mini panel

jwilson3’s picture

Status: Closed (won't fix) » Closed (duplicate)

Marking status as duplicate... there is interest in this feature and there are already some patches on the follow up issue #1391450: Panels does not hide an empty mini panel.

jwilson3’s picture

Issue summary: View changes

Added link to followup issue.

jwilson3’s picture

Issue summary: View changes

Link to 2 follow up issues.

ShaunDychko’s picture

Issue summary: View changes