My cocaine refinery can't produce output because my storage is always full of weed. What should I do?
Block code from custom template is here
/**
* Implements hook_theme().
*/
function my_custom_block_theme() {
$theme = array();
$theme = array(
'my_custom_block_output' => array(
'variables' => array('items' => array()),
'path' => drupal_get_path('module', 'my_custom_block') . '/templates',
'template' => 'block--my-custom-block'
),
'my_custom_header_block_output' => array(
'variables' => array('items' => array()),
'path' => drupal_get_path('module', 'my_custom_block') . '/templates',
'template' => 'block--my-custom-header-block'
),
);
return $theme;
}
/**
* Implements hook_block_info().
*/
function my_custom_block_block_info() {
$blocks['my_custom_block_output_block'] = array(
'info' => t('Custom one'),
'cache' => DRUPAL_CACHE_PER_ROLE,
);
$blocks['my_custom_home_block_output_block'] = array(
'info' => t('Custom two'),
'cache' => DRUPAL_CACHE_PER_ROLE,
);
return $blocks;
}
**
* Implements hook_block_view().
*/
function my_custom_block_block_view($delta = '') {
$block = array();
switch ($delta) {
case 'my_custom_block_output_block':
$block['subject'] = t('Block one');
$block['content'] = _my_custom_block_block_content();
break;
case 'my_custom_home_block_output_block':
$block['subject'] = t('Block 2');
$block['content'] = _my_custom_home_block_block_content();
break;
}
return $block;
}
/**
* Callback implemented by hook_block_view().
*/
function _my_custom_block_block_content() {
//Your custom values for output in $items
$items = get_data();
$output = theme('my_custom_block_output', array('items' => $items));
return $output;
}
function _my_custom_home_block_block_content() {
//Your custom values for output in $items
$items = get_data();
$output = theme('my_custom_header_block_output', array('items' => $items));
return $output;
}
//Data to be output
function get_data(){
//Your custom code
}
Template file(.tpl) should be in "template" directory Eg :
template/block--my-custom-block.tpl.php
template/block--my-custom-header-block