You are here

function node_update_7004 in Drupal 7

Extend the existing default preview and teaser settings to all node types.

Related topics

File

modules/node/node.install, line 573
Install, update and uninstall functions for the node module.

Code

function node_update_7004() {

  // Get original settings and all types.
  $original_length = variable_get('teaser_length', 600);
  $original_preview = variable_get('node_preview', 0);

  // Map old preview setting to new values order.
  $original_preview ? $original_preview = 2 : ($original_preview = 1);
  node_type_cache_reset();

  // Apply original settings to all types.
  foreach (_update_7000_node_get_types() as $type => $type_object) {
    variable_set('teaser_length_' . $type, $original_length);
    variable_set('node_preview_' . $type, $original_preview);
  }

  // Delete old variable but leave 'teaser_length' for aggregator module upgrade.
  variable_del('node_preview');
}