You are here

function addressfield_staticmap_preprocess in Address Field Static Map 7

Implements hook_preprocess().

File

./addressfield_staticmap.module, line 820
Main file for the addressfield static map module.

Code

function addressfield_staticmap_preprocess(&$variables, $hook) {
  if ($hook !== 'addressfield_staticmap_static_map' || is_null($variables['entity'])) {
    return;
  }
  $eid_field = addressfield_entity_id_from_entity_type($variables['entity']);
  if ($eid_field) {
    $hooks = array(
      'addressfield_staticmap_static_map__' . $variables['entity']->base_type,
    );
    if (isset($variables['entity']->type)) {
      $hooks[] = 'addressfield_staticmap_static_map__' . $variables['entity']->base_type . '__' . $variables['entity']->type;
    }
    $hooks[] = 'addressfield_staticmap_static_map__entity_' . $variables['entity']->{$eid_field};
    $variables['theme_hook_suggestions'] = array_merge($hooks, $variables['theme_hook_suggestions']);
  }
}