How can I retrieve the context from a panel to a custom block placed in it ? (with panels 3)

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

I don't figure out how to retrieve the panel's context to modifie the block's content.
Maybe would I better to make a new pane instead a new block ?
It's would be great if I could choose the context and pass arguments form the block setting in panel, like with a view.

Let's imagine I've made a custom block in a custom module like this :

function custom_module_block($op = 'list', $delta = 0, $edit = array()) {
  switch($op) {
    case 'list': {
     $blocs=array();
        $blocs['text_block'] = array(
          'info'    =>  t('Test block'),
          'cache'   =>  BLOCK_CACHE_PER_ROLE | BLOCK_CACHE_PER_PAGE,
      );
     return $blocs;
   }
        case 'view': {
         $block=array();
        if ($delta == 'text_block') {
          $contenu = "Test block content";
         $block['subject'] = t('Test block');
           $block['content'] = $contenu;
          }
          return $block;
       }
  }
}

Any idea to achieve this ?

Comments

I also want to do something like this...

perceptum's picture

Hi , I also want to do something like this - did you ever figure it out?

--
Bryan Gruneberg
Chief ninja in charge at Perceptum Thought Squad

Google Talk bryan@perceptum.za.net
Skype perceptum-ts

Figured it out!

perceptum's picture

http://shellmultimedia.com/articles/creating-content-type-ctools-panels-3

It looks a bit daunting at first - but only took me an hour to get my contextualized block working! Let me know if you need a hand...

Regards
Bryan

--
Bryan Gruneberg
Chief ninja in charge at Perceptum Thought Squad

Google Talk bryan@perceptum.za.net
Skype perceptum-ts

Panels

Group organizers

Group notifications

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