diff --git a/taxonomy_title.module b/taxonomy_title.module index 461ea21..98fb922 100644 --- a/taxonomy_title.module +++ b/taxonomy_title.module @@ -40,6 +40,13 @@ function taxonomy_title_form_taxonomy_form_term_alter(&$form, &$form_state) { '#description' => t('This is the title you will see in the heading tag on your taxonomy term page. If left blank, the term name will be used.'), '#weight' => 0, ); + + if ( $title !== false ){ + $form['identification']['taxonomy_title_had_previous_value'] = array( + '#type' => 'value', + '#value' => true + ); + } } } @@ -54,13 +61,16 @@ function taxonomy_title_taxonomy($op, $type, $array = NULL) { break; case 'update': - if (isset($array['taxonomy_title'])) { + if (!empty($array['taxonomy_title'])) { _taxonomy_title_update($array['tid'], $array['taxonomy_title']); } + if ( $array['taxonomy_title_had_previous_value'] === true && empty($array['taxonomy_title']) ) { + _taxonomy_title_delete($array['tid']); + } break; case 'insert': - if (isset($array['taxonomy_title'])) { + if (!empty($array['taxonomy_title'])) { _taxonomy_title_insert($array['tid'], $array['taxonomy_title']); } break;