I have a custom module that build a block. I'm trying to add a tpl file, but I don't get nothing. This is my code:
<?php
/**
* Implements hook_block_info().
*
* This hook declares what blocks are provided by the module.
*/
function tados2_block_info() {
$blocks = array();
$blocks['block_with_tpl'] = array(
// info: The name of the block.
'info' => t('Tados2 example: block with tpl'),
'status' => TRUE,
);
return $blocks;
}
/**
* Implements hook_block_view().
*
* This hook generates the contents of the blocks themselves.
*/
function tados2_block_view($delta = '') {
switch ($delta) {
case'block_with_tpl':
// The subject is displayed at the top of the block. Note that it
// should be passed through t() for translation. The title configured
// for the block using Drupal UI supercedes this one.
$block['subject'] = t('Tados2 block with tpl');
// The content of the block is typically generated by calling a custom
// function.
$block['content'] = t('Hola mundo');//_tados2_block_with_tpl_contents();
break;
}
return $block;
}
?>
I'm trying to move the content to a tpl.php file.
This what I'm trying:
<?php
/**
*
* Implementen hook_theme
*
*/
function tados2_theme(){
return array(
'tados2_block' => array(
//'render element' => 'elements',
'template' => 'tados2_block',
'variables' => array('title' => NULL, 'content' => NULL),
),
);
}
/**
* preprocess function
*
*/
function template_preprocess_tados2_block(&$variables) {
dpm($variables);
}
?>