How to pass a form and other variables to theme functions? I wonder how can I pass a form and other variables (an array) to hook_theme(), I know that if you want to render a form in hook theme you have to use 'render element' so now I can't use 'variables' to pass my variable array. here is what I did to render the form:

function example_theme() {
  return array(
    'deductible_form' =&gt; array(
      'arguments'      =&gt; array('form' =&gt; NULL),
      'template'       =&gt; 'example',    
      'render element' =&gt; 'form',    
     ),
  );
}


What can I do to solve this?
As you rightly say you can't pass variables to a theme function that uses a render element, but then you don't need to.

One of the points of the render element is that the element already contains all of the properties/variables that it needs to perform the render, without having to get them from anywhere else.

A themed form is actually a good example for this: if you need to add extra variables in order to render that form, then they should be arguments to the form function itself. e.g.:

function deductible_form($form, &amp;$form_state, $var1, $var2) {
  $form['#theme'] = 'deductible_form';
  $form['#var1'] = $var1;
  $form['#var2'] = $var2;

  // etc...

  return $form;
}


Then in your form's theme function you can easily access those vars:

function theme_deductible_form($vars) {
  $form = $vars['form'];

  $var1 = $form['#var1'];
  $var2 = $form['#var2'];

  // Render the form
}


All you need to do to get that form to render properly now is to call drupal_get_form() with your extra variables:

$form = drupal_get_form('deductible_form', $var1, $var2);