You are here

function nodesinblock_block in Nodes In Block 6

Implementation of hook_block().

File

./nodesinblock.module, line 213
Nodes in block makes it possible to add multiple nodes in one block.

Code

function nodesinblock_block($op = 'list', $delta = 0, $edit = array()) {
  switch ($op) {
    case 'list':
      $number_of_blocks = variable_get('nodesinblock_nrofblocks', 1);
      for ($i = 0, $a = 1; $i < $number_of_blocks; $i++, $a++) {
        $blocks[$i] = array(
          'info' => check_plain(variable_get('nodesinblock_friendlyname_' . $i, t('Nodes in block ' . $a))),
          'weight' => 0,
          'enabled' => 0,
          'region' => 'left',
          'cache' => BLOCK_CACHE_PER_PAGE,
        );
      }
      return $blocks;
      break;
    case 'view':
      $a = $delta + 1;
      $block = array(
        'subject' => check_plain(variable_get('nodesinblock_friendlyname_' . $delta, t('Nodes in block ' . $a))),
        'content' => _nodesinblock_show($delta, variable_get('nodesinblock_visibility_' . $delta, '1')),
      );
      return $block;
      break;
  }
}