You are here

function addanother_update_7001 in Add Another 7.2

Port over to the new variable storage system.

File

./addanother.install, line 41
Install, update and uninstall functions for the Add another module.

Code

function addanother_update_7001() {
  $types = node_type_get_types();
  $addanother_nodetypes = variable_get('addanother_nodetypes', array());
  $tab = variable_get('addanother_tab', FALSE);
  $tabedit = variable_get('addanother_tab_edit', FALSE);
  $message = variable_get('addanother_message', FALSE);
  foreach ($types as $type) {
    $typeid = $type->type;
    if (!empty($addanother_nodetypes[$typeid])) {
      if ($message) {
        variable_set('addanother_message_' . $typeid, TRUE);
      }
      if ($tab) {
        variable_set('addanother_tab_' . $typeid, TRUE);
      }
      if ($tabedit) {
        variable_set('addanother_tab_edit_' . $typeid, TRUE);
      }
    }
  }
  variable_del('addanother_nodetypes');
  variable_del('addanother_tab');
  variable_del('addanother_tab_edit');
  variable_del('addanother_message');
  return t('Existing Add another node options have been upgraded.  Please review the new Add another options for each node type.');
}