I wanted to be able to control the layout and containers for all elements (choice,title,vote etc) inside my poll block and decided to add my own template for the same.
Like any noob, I checked the block with devel and got the block template file,preprocess methods used (in my case poll-vote.tpl inside drupal core poll module and the template_preprocess_poll_vote inside poll.module) and the candidate file name for the template as poll-vote-block.tpl.php inside my themes directory (sites/all/themes/my_theme) and in the theme's corresponding template.php used the preprocess function as follows:
function my_theme_preprocess_poll_vote(&$variables) {
echo 'Im in';
$form = $variables['form'];
$variables['choice'] = drupal_render($form['choice']);
$variables['title'] = check_plain($form['#node']->title);
$variables['vote'] = drupal_render($form['vote']);
$variables['rest'] = drupal_render($form);
$variables['block'] = $form['#block'];
// If this is a block, allow a different tpl.php to be used.
if ($variables['block']) {
$variables['template_files'][] = 'poll-vote-block-custom';
}
print_r($variables['template_files']);
}
Initially I set the template_files value as 'poll-vote-block' and it didn't seem to be affecting the block, which i confirmed with devel again.
I printed the echo message to ensure the preprocess was called and it did print it. I renamed the template_files (and the template file) and printed it to get the following:
Array ( [0] => poll-vote-block [1] => poll-vote-block-custom )
I once came across theme templating in drupal docs that preprocess methods are not necessarily overridden but placed in a queue... to me it appears that my preprocess method's tpl file is set with lower priority and hence unable to override. Hence I'm unable to fulfil my requirement of theming the poll block
It'd be nice know if I'm mistaken with this conception and hope someone would provide me some insight on this to get my problem solved.
Thanks in advance!!
Edit
The problem was finally solved. I created a block-poll.tpl.php file and was then able to override the default poll-vote.tpl.php with my preprocess method and poll-vote-block-custom.tpl.php.
Apparently just like the case where one needs block.tpl.php for his block-module-delta.tpl.php to override a default functionality this might've been my case.
Marking jimajamma's answer as solution as it proves to be a good documentation and reference material worth being a wiki for Drupal theming for novice developers.
Cheers!!