You are here

function auto_menutitle_update_1001 in Auto Menu Title 6.2

Copy the old setting for 'collapsible', so we can support the new option for enabling, but not checking on

File

./auto_menutitle.install, line 41
auto_menutitle alters the menu_links table for storing menu settings. It also stores a number of variables in the variable table too. This file handles the install/uninstall of this data, cleanly.

Code

function auto_menutitle_update_1001() {
  $ret = array();
  $t = get_t();
  foreach (node_get_types('names') as $type => $type_name) {
    $setting = variable_get('amt_' . $type, 0);
    if ($setting == 2) {

      // 2 was the value of AUTO_MENUTITLE_ENABLED_COLLAPSE in v1.21/1.22
      variable_set('amt_collapsed_' . $type, TRUE);
      variable_set('amt_' . $type, 1);

      // Would have been on by default.
      $ret['amt_' . $type] = array(
        'title' => $t('Auto menutitle'),
        'value' => $t('Auto menutitle (' . $story . ')'),
        'description' => $t('Adjusted default menutitle setting for ' . $type . ', as these have changed. No data lost.'),
        'severity' => REQUIREMENT_OK,
      );
    }
  }
  return $ret;
}