You are here

function static_map_cache_file_delete in Static Map 7

Delete a cached map when the rendered map changes.

Parameters

string $entity_type: Type of entity.

string $entity: Entity name.

object $instance: Entity instance.

1 call to static_map_cache_file_delete()
staticmap_field_formatter_view in ./staticmap.module
Implements hook_field_formatter_view().

File

./staticmap.module, line 259
SiteMap module.

Code

function static_map_cache_file_delete($entity_type, $entity, $instance) {
  $query = db_select('file_managed', 'f')
    ->condition('f.filename', static_map_cache_file_prefix($entity_type, $entity, $instance) . '%', 'LIKE')
    ->fields('f', array(
    'fid',
  ));
  $result = $query
    ->execute()
    ->fetchField();
  if ($result) {
    file_delete(file_load($result));
  }
}