You are here

function page_title_update_7200 in Page Title 8.2

Same name and namespace in other branches
  1. 7.2 page_title.install \page_title_update_7200()

Implements hook_update_n(). Rename all the Vocabulary settings to reference by the new Machine Name, rather than Vocab ID.

File

./page_title.install, line 67
page_title.install

Code

function page_title_update_7200() {
  $ret = array();

  // If taxonomy not enabled, do no further updates
  if (!module_exists('taxonomy')) {
    return $ret;
  }
  foreach (taxonomy_get_vocabularies() as $vocab) {
    $page_title_vocab_settings = variable_get("page_title_vocab_{$vocab->vid}", FALSE);
    $page_title_vocab_showfield = variable_get("page_title_vocab_{$vocab->vid}_showfield", FALSE);
    if ($page_title_vocab_settings) {
      variable_set("page_title_vocab_{$vocab->machine_name}", $page_title_vocab_settings);
    }
    if ($page_title_vocab_showfield) {
      variable_set("page_title_vocab_{$vocab->machine_name}_showfield", $page_title_vocab_showfield);
    }
    variable_del("page_title_vocab_{$vocab->vid}_showfield");
    variable_del("page_title_vocab_{$vocab->vid}");
  }
  return $ret;
}