You are here

function asset_widget_preprocess_entity in Asset 7

Process variables for entity.tpl.php.

File

modules/asset_widget/asset_widget.module, line 854
Code for the Asset widget module.

Code

function asset_widget_preprocess_entity(&$vars) {
  if ($vars['entity_type'] == 'asset') {

    // Add suggestion for common template.
    $vars['theme_hook_suggestions'][] = $vars['entity_type'] . '__' . $vars['view_mode'];

    // Include file with preprocesses.
    module_load_include('inc', 'asset_widget', 'theme/theme');

    // Run existing preprocesses.
    foreach (array_reverse($vars['theme_hook_suggestions']) as $suggestion) {
      $preprocess = "template_preprocess_{$suggestion}";
      if (function_exists($preprocess)) {
        $preprocess($vars);

        // Note, that we call only one preprocess, but it could be easily changed.
        break;
      }
    }
  }
}