Hide mini panels when empty

BWPanda - March 13, 2009 - 00:45
Project:Panels
Version:6.x-3.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:won't fix
Issue tags:cck filefield, hide or show, mini panels, panels
Description

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.

#1

davidcgutman - March 13, 2009 - 03:29

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...

#2

BWPanda - June 15, 2009 - 04:53
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 report» feature request

Making this a feature request instead.

#3

merlinofchaos - July 21, 2009 - 21:29
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.

#4

EvanDonovan - October 14, 2009 - 16:00

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.

#5

Tarsjusz - October 18, 2009 - 11:33

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.

#6

brianmercer - October 18, 2009 - 19:49

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.

#7

ShaneOnABike - October 29, 2009 - 16:10

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);

#8

doubledoh - November 2, 2009 - 22:19

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.

#9

merlinofchaos - November 3, 2009 - 01:26

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.

#10

sdboyer - November 10, 2009 - 15:51
Status:active» 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.

 
 

Drupal is a registered trademark of Dries Buytaert.