Hi,
I've built a panel page (via chaos tool suite) to get some variants of a node view.
In this panel page, i've placed a custom block from some one of my custom modules.
I don't figure out how to get the node nid to the custom block in order to modifie the block's content.

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

merlinofchaos’s picture

Status: Active » Fixed

You will be a lot better off if you create a content type plugin rather than using a block. The whole reason that content type plugins exist is that blocks cannot easily get information passed to them, and content types can.

A good article on doing that is here: http://shellmultimedia.com/articles/creating-content-type-ctools-panels-3

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.