Skip to main content
1 of 2
FLY
  • 1.9k
  • 2
  • 26
  • 59

Whats wrong with this implementation of hook_block_info / hook_block_view

I'm trying to create a module that creates a block to a specific region so I use this module on multiple sites instead of using the admin menu copy and pasting creating blocks with HTML code in it and putting it in the region that I want it to be.

Somehow the block doesn't even shows up in the blocks admin section. Maybe I'm overlooking something but I quite sure my code is correct for the hooks implemented below:

/**
 * Implements hook_block_info()
 */
function bannert_block_info() {
    $blocks['bannert'] = array(
        'info' => t('bannert'),
        'cache' => DRUPAL_CACHE_PER_PAGE,
        'region' => 'three_33_third',
        'status' => 1,
    );
    
    return $blocks;
}

/**
 * Implements hook_bock_view()
 */
function bannert_block_view(){
    $block['subject'] = t('');
    $block['content'] = _bannert_get_bannert();
    
    return $block;
}

/**
 * get banner 
 */
function _bannert_get_bannert() {
    return include_once('banner.html');
}

The only thing I'm doubting about is the _bannert_get_bannert() function but that doesn't prevent the block from being created, now does it?

I'm getting this error now:

Warning: Cannot use a scalar value as an array in _block_get_renderable_array() (line 346 of /Users/Jack/Sites/drupal-7/modules/block/block.module). Fatal error: Unsupported operand types in /Users/Jack/Sites/drupal-7/modules/block/block.module on line 352

FLY
  • 1.9k
  • 2
  • 26
  • 59