How to controll a single pane visibility in panels2

Events happening in the community are now at Drupal community events on www.drupal.org.
ttoman's picture

I stopped on this one and I'd really need some help or hint:

I created module »custom_panel.module« with this short test code:

<?php
function custom_panel_panels_pane_content_alter($content, $pane, $args, $context)
{
  $content->content = 'some';
  return $content;
}

Of course all panes on page get »some« content.
I'd like control visibility to just one or two panes on a page with if loop in program code. Let's say:

If (some condition) {
  Show me »pane1« and hide all others;
}

This is the last part from my panel-page export with (I believe) a pane, which visibility I'd like to control (»new-9«):

$pane = new stdClass();
  $pane->pid = 'new-9';
  $pane->panel = 'top';
  $pane->type = 'content_field';
  $pane->subtype = 'description';
  $pane->access = array();
  $pane->configuration = array (
    'context' => 'argument_nid_1',
    'style' => 'rounded_corners',
    'override_title' => 1,
    'override_title_text' => 'Opis',
    'css_id' => '',
    'css_class' => '',
    'label' => 'hidden',
    'field_formatter' => 'field_opis:default',
  );
  $pane->shown = '1';
  $display->content['new-9'] = $pane;
  $display->panels['top'][0] = 'new-9';
$page->displays['argument_0-stranke']['display'] =  $display;

Could you please show me, how to control this single pane visibility?

Thank you,
Tom from Slovenia

Panels

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: