I'm trying to replace the theme() with render() as recommended:
https://api.drupal.org/api/drupal/includes!theme.inc/function/theme/7
So I started with:
function mymodule_block_view()
{
$variables['module_path'] = drupal_get_path('module', 'mymodule');
$block['subject'] = t('mymodule Slide');
$block['content'] = theme('mymodule', $variables);
return $block;
}
And I tried
function mymodule_block_view()
{
$variables['module_path'] = drupal_get_path('module', 'mymodule');
$block['subject'] = t('OpenDTP Slide');
$rdr = array(
'#theme' => 'opendtp_slide',
'#module_path' => $variables['module_path'],
);
$block['content'] = render($rdr);
return $block;
}
But it says Undefined variable for module_path that I used in the tpl.php file. How I'm a supposed to use variables in the template then ? What is the correct way of doing it ?