hook_theme default arguments not recognised in template When using hook_theme I create an array of variables with default values:

/**
 * Implementation of hook_theme
 */
function my_module_theme() {

  return array(

    'my_theme' =&gt; array(
      'arguments' =&gt; array(
        'var1' =&gt; 'default value',
      ),
      'template' =&gt; 'my-theme',
    ),

  );
}


And the template file my-theme.tpl.php:

&lt;div&gt;&lt;?php print $var1; ?&gt;&lt;/div&gt;


But inside the corresponding template the $var1 variable is only recognised if I explicitly send it with the theme() implementation:

print theme('my_theme', array('var1' =&gt; 'New var'); // No errors

print theme('my_theme'); // Notice: Undefined variable: var1 in include()


My understanding of the default arguments are just that - they should be the default if they are not explicitly defined. What am I missing?
You have to do like

/**
 * Implementation of hook_theme
 */
function my_module_theme() {

return array(

'my_theme' =&gt; array(
  'variables' =&gt; array(
    'var1' =&gt; 'default value',
  ),
  'template' =&gt; 'my-theme',
),


);
}

Instead of arguments use variables.

Hope this will help.