You are here

function gmap_taxonomy_taxonomy_term_update in GMap Module 7

Same name and namespace in other branches
  1. 7.2 gmap_taxonomy.module \gmap_taxonomy_taxonomy_term_update()

Implement hook_taxonomy_term_update().

1 call to gmap_taxonomy_taxonomy_term_update()
gmap_taxonomy_taxonomy_term_insert in ./gmap_taxonomy.module
Implement hook_taxonomy_term_insert().

File

./gmap_taxonomy.module, line 103
GMap Taxonomy Markers

Code

function gmap_taxonomy_taxonomy_term_update($term) {
  if (gmap_taxonomy_vocabulary_is_enabled($term->vid)) {
    db_delete('gmap_taxonomy_term')
      ->condition('tid', $term->tid)
      ->execute();

    // Do we have an assigned marker?
    if (!empty($term->gmap_taxonomy_marker)) {
      db_insert('gmap_taxonomy_term')
        ->fields(array(
        'tid' => $term->tid,
        'marker' => $term->gmap_taxonomy_marker,
      ))
        ->execute();

      // Update name changes in the gmap_taxonomy_node table.
      db_update('gmap_taxonomy_node')
        ->fields(array(
        'marker' => $term->gmap_taxonomy_marker,
      ))
        ->condition('tid', $term->tid)
        ->execute();
    }
    gmap_taxonomy_reassign_marker($term->tid);
  }
}