Define variables for specific template I would like to pass variables to a single specific template file(tpl.php).
My setting is the following:

my_entities.module

function my_entities_theme($existing, $type, $theme, $path) {
  return array(
    'my_entities_property' =&gt; array(
      'variables' =&gt; array('element' =&gt; null),
      'template' =&gt; 'my-entities-property'
    )
  );
}


I am using a template file at my_theme/templates/my-entities-property.tpl.php

In the module file I am trying to invoke a preprocess function to add a variable but it is not being invoked.

function template_preprocess_my_entities_property(&amp;$variables) {
  $variables['test'] = "test";
}


How could I make this work?  I followed https://www.drupal.org/node/2275895#comment-8832701 but it seems that I am doing something wrong.
You should put your template in your module as well.

my_theme/templates/my-entities-property.tpl.php


Make sure to update your theme function like this :

function my_entities_theme($existing, $type, $theme, $path) {
  return array(
    'my_entities_property' =&gt; array(
      'variables' =&gt; array('element' =&gt; null),
      'template' =&gt; 'my-entities-property',
      'path' =&gt; drupal_get_path('module', 'my_entities') . '/templates'
    )
  );
}


Try to use THEME_preprocess_my_entities_property(&amp;$variables) in template.php instead.